From 77f1fedde2749bfc61be21ffa9885f780436ac25 Mon Sep 17 00:00:00 2001 From: Edwin Date: Thu, 10 Mar 2022 08:44:43 -0800 Subject: [PATCH] Build both AIDL and HIDL targets. Merged from http://go/wvgerrit/147689 The default is to build for AIDL Widevine service. Use "-t hidl" in build_and_run_all_unit_tests.sh or build_all_unit_tests.sh to build for HIDL service. Test: ./build_all_unit_tests -t hidl Test: ./build_and_run_all_unit_tests -t hidl Test: ./build_all_unit_tests Test: ./build_and_run_all_unit_tests Bug: 217247987 Change-Id: Ie7c51033f4aba341c829ccc8f846a6cfeab76df3 --- libwvdrmengine/build_all_unit_tests.sh | 12 +++++++++--- libwvdrmengine/cdm/test/coverage-test.mk | 15 +++++++++++++-- libwvdrmengine/cdm/test/integration-test.mk | 15 +++++++++++++-- libwvdrmengine/cdm/test/unit-test.mk | 14 +++++++++++++- libwvdrmengine/oemcrypto/test/common.mk | 15 +++++++++++++-- 5 files changed, 61 insertions(+), 10 deletions(-) diff --git a/libwvdrmengine/build_all_unit_tests.sh b/libwvdrmengine/build_all_unit_tests.sh index 091147e3..093d07b0 100755 --- a/libwvdrmengine/build_all_unit_tests.sh +++ b/libwvdrmengine/build_all_unit_tests.sh @@ -8,10 +8,13 @@ if [ -z "$ANDROID_BUILD_TOP" ]; then fi # Read arguments in case the user wants to do a multicore build or -# copy files to a specific android device by providing a serial number +# copy files to a specific android device by providing a serial number. +# The default build target is for AIDL service, use "-t hidl" to +# build for HIDL service. +BUILD_TARGET="" NUM_CORES=1 SERIAL_NUM="" -while getopts "j:s:" opt; do +while getopts "j:s:t:" opt; do case $opt in j) NUM_CORES=$OPTARG @@ -19,6 +22,9 @@ while getopts "j:s:" opt; do s) SERIAL_NUM="-s $OPTARG" ;; + t) + BUILD_TARGET="BUILD_TARGET=$OPTARG" + ;; esac done @@ -74,7 +80,7 @@ WV_TEST_TARGETS="base64_test \ cd $ANDROID_BUILD_TOP pwd -m -j $NUM_CORES $WV_TEST_TARGETS +m -j $NUM_CORES $WV_TEST_TARGETS $BUILD_TARGET # Detect the device and check if Verity is going to stop the script from working diff --git a/libwvdrmengine/cdm/test/coverage-test.mk b/libwvdrmengine/cdm/test/coverage-test.mk index b2de5221..f22bada3 100644 --- a/libwvdrmengine/cdm/test/coverage-test.mk +++ b/libwvdrmengine/cdm/test/coverage-test.mk @@ -3,6 +3,17 @@ # include $(CLEAR_VARS) +BUILD_TARGET?= +ifeq ($(BUILD_TARGET), hidl) +$(info Building '$(test_name)' for HIDL service.) +HIDL_EXTENSION := _hidl +LIB_BINDER := libhidlbase +else +$(info Building '$(test_name)' for AIDL service.) +HIDL_EXTENSION := +LIB_BINDER := libbinder +endif + LOCAL_LICENSE_CONDITIONS := by_exception_only LOCAL_LICENSE_KINDS := legacy_by_exception_only LOCAL_MODULE := cdm_coverage_test @@ -55,7 +66,7 @@ LOCAL_C_INCLUDES += external/protobuf/src LOCAL_STATIC_LIBRARIES := \ libcdm \ libcdm_protos \ - libcdm_utils_hidl \ + libcdm_utils$(HIDL_EXTENSION) \ libjsmn \ libgmock \ libgtest \ @@ -67,7 +78,7 @@ LOCAL_SHARED_LIBRARIES := \ libbase \ libcrypto \ libdl \ - libhidlbase \ + $(LIB_BINDER) \ liblog \ libmedia_omx \ libprotobuf-cpp-lite \ diff --git a/libwvdrmengine/cdm/test/integration-test.mk b/libwvdrmengine/cdm/test/integration-test.mk index a5075993..4dce587e 100644 --- a/libwvdrmengine/cdm/test/integration-test.mk +++ b/libwvdrmengine/cdm/test/integration-test.mk @@ -6,6 +6,17 @@ $(call assert-not-null,test_name) include $(CLEAR_VARS) +BUILD_TARGET?= +ifeq ($(BUILD_TARGET), hidl) +$(info Building '$(test_name)' for HIDL service.) +HIDL_EXTENSION := _hidl +LIB_BINDER := libhidlbase +else +$(info Building '$(test_name)' for AIDL service.) +HIDL_EXTENSION := +LIB_BINDER := libbinder +endif + LOCAL_MODULE := $(test_name) LOCAL_LICENSE_KINDS := legacy_by_exception_only LOCAL_LICENSE_CONDITIONS := by_exception_only @@ -45,7 +56,7 @@ LOCAL_C_INCLUDES += external/protobuf/src LOCAL_STATIC_LIBRARIES := \ libcdm \ libcdm_protos \ - libcdm_utils_hidl \ + libcdm_utils$(HIDL_EXTENSION) \ libjsmn \ libgmock \ libgtest \ @@ -57,7 +68,7 @@ LOCAL_SHARED_LIBRARIES := \ libbase \ libcrypto \ libdl \ - libhidlbase \ + $(LIB_BINDER) \ liblog \ libmedia_omx \ libprotobuf-cpp-lite \ diff --git a/libwvdrmengine/cdm/test/unit-test.mk b/libwvdrmengine/cdm/test/unit-test.mk index 28985e61..5bdde39b 100644 --- a/libwvdrmengine/cdm/test/unit-test.mk +++ b/libwvdrmengine/cdm/test/unit-test.mk @@ -6,6 +6,17 @@ $(call assert-not-null,test_name) include $(CLEAR_VARS) +BUILD_TARGET?= +ifeq ($(BUILD_TARGET), hidl) +$(info Building '$(test_name)' for HIDL service.) +HIDL_EXTENSION := _hidl +LIB_BINDER := libhidlbase +else +$(info Building '$(test_name)' for AIDL service.) +HIDL_EXTENSION := +LIB_BINDER := libbinder +endif + LOCAL_MODULE := $(test_name) LOCAL_LICENSE_KINDS := legacy_by_exception_only LOCAL_LICENSE_CONDITIONS := by_exception_only @@ -42,7 +53,7 @@ LOCAL_C_INCLUDES += external/protobuf/src LOCAL_STATIC_LIBRARIES := \ libcdm \ libcdm_protos \ - libcdm_utils_hidl \ + libcdm_utils$(HIDL_EXTENSION) \ libjsmn \ libgmock \ libgtest \ @@ -54,6 +65,7 @@ LOCAL_SHARED_LIBRARIES := \ libcrypto \ libdl \ libhidlbase \ + $(LIB_BINDER) \ liblog \ libmedia_omx \ libprotobuf-cpp-lite \ diff --git a/libwvdrmengine/oemcrypto/test/common.mk b/libwvdrmengine/oemcrypto/test/common.mk index 4e98dbdb..e4c31d53 100644 --- a/libwvdrmengine/oemcrypto/test/common.mk +++ b/libwvdrmengine/oemcrypto/test/common.mk @@ -1,5 +1,16 @@ LOCAL_PATH:= $(call my-dir) +BUILD_TARGET?= +ifeq ($(BUILD_TARGET), hidl) +$(info Building 'oemcrypt_test' for HIDL service.) +HIDL_EXTENSION := _hidl +LIB_BINDER := libhidlbase +else +$(info Building 'oemcrypt_test' for AIDL service.) +HIDL_EXTENSION := +LIB_BINDER := libbinder +endif + ifeq ($(filter mips mips64, $(TARGET_ARCH)),) # Tests need to be compatible with devices that do not support gnu hash-style LOCAL_LDFLAGS+=-Wl,--hash-style=both @@ -38,7 +49,7 @@ LOCAL_STATIC_LIBRARIES := \ libgtest_main \ libwvlevel3 \ libcdm_protos \ - libcdm_utils_hidl \ + libcdm_utils$(HIDL_EXTENSION) \ libwv_kdo \ libwv_odk \ @@ -46,7 +57,7 @@ LOCAL_SHARED_LIBRARIES := \ libbase \ libcrypto \ libdl \ - libhidlbase \ + $(LIB_BINDER) \ liblog \ libmedia_omx \ libprotobuf-cpp-lite \