Merge "Update unit tests to build into /data/bin" into oc-dev am: b683d2be57

am: fc7e636bdf

Change-Id: I311feb5f5f0c060bf776780de4cca3395d023239
This commit is contained in:
Kyle Alexander
2017-06-13 22:21:39 +00:00
committed by android-build-merger
10 changed files with 106 additions and 75 deletions

View File

@@ -47,7 +47,7 @@ mm -j $NUM_CORES || mma -j $NUM_CORES
# Detect the device and check if Verity is going to stop the script from working
echo "waiting for device"
ADB_OUTPUT=`adb root && adb wait-for-device remount`
ADB_OUTPUT=`adb root && echo ". " && adb wait-for-device remount`
echo $ADB_OUTPUT
if echo $ADB_OUTPUT | grep -qi "verity"; then
echo
@@ -59,43 +59,49 @@ fi
# Push the files to the device
# Given a local path to a file, this will first try to push it to /vendor/bin
# and then, if that fails, to /data/widevine_tests.
# Given a local path to a file, this will try to push it to /data/bin.
# If that fails, an error message will be printed.
try_adb_push() {
# Swallow the error message -- assume it is a read-only file system.
if ! adb push $@ /vendor/bin &> /dev/null; then
adb shell mkdir -p /data/widevine_tests
# If this fails, the user will get the error message.
adb push $@ /data/widevine_tests
# android-tests.zip requires /data/bin, we should use the same
if [ -f $OUT/data/bin/$1 ]; then
test_file=$OUT/data/bin/$1
else
echo "I cannot find $1"
echo "I think it should be in $OUT/data/bin"
exit 1
fi
adb shell mkdir -p /data/bin
adb push $test_file /data/bin/$1
}
# Push the tests to the device
try_adb_push $OUT/vendor/bin/oemcrypto_test
try_adb_push $OUT/vendor/bin/request_license_test
try_adb_push $OUT/vendor/bin/cdm_extended_duration_test
try_adb_push $OUT/vendor/bin/policy_engine_unittest
try_adb_push $OUT/vendor/bin/policy_engine_constraints_unittest
try_adb_push $OUT/vendor/bin/libwvdrmmediacrypto_test
try_adb_push $OUT/vendor/bin/libwvdrmmediacrypto_hidl_test
try_adb_push $OUT/vendor/bin/libwvdrmdrmplugin_test
try_adb_push $OUT/vendor/bin/libwvdrmdrmplugin_hidl_test
try_adb_push $OUT/vendor/bin/cdm_engine_test
try_adb_push $OUT/vendor/bin/cdm_session_unittest
try_adb_push $OUT/vendor/bin/file_store_unittest
try_adb_push $OUT/vendor/bin/file_utils_unittest
try_adb_push $OUT/vendor/bin/license_unittest
try_adb_push $OUT/vendor/bin/license_keys_unittest
try_adb_push $OUT/vendor/bin/initialization_data_unittest
try_adb_push $OUT/vendor/bin/device_files_unittest
try_adb_push $OUT/vendor/bin/usage_table_header_unittest
try_adb_push $OUT/vendor/bin/service_certificate_unittest
try_adb_push $OUT/vendor/bin/timer_unittest
try_adb_push $OUT/vendor/bin/libwvdrmengine_test
try_adb_push $OUT/vendor/bin/libwvdrmengine_hidl_test
try_adb_push $OUT/vendor/bin/buffer_reader_test
try_adb_push $OUT/vendor/bin/distribution_test
try_adb_push $OUT/vendor/bin/event_metric_test
try_adb_push base64_test
try_adb_push buffer_reader_test
try_adb_push cdm_engine_test
try_adb_push cdm_extended_duration_test
try_adb_push cdm_session_unittest
try_adb_push device_files_unittest
try_adb_push distribution_test
try_adb_push event_metric_test
try_adb_push file_store_unittest
try_adb_push file_utils_unittest
try_adb_push http_socket_test
try_adb_push initialization_data_unittest
try_adb_push libwvdrmdrmplugin_hidl_test
try_adb_push libwvdrmdrmplugin_test
try_adb_push libwvdrmengine_hidl_test
try_adb_push libwvdrmengine_test
try_adb_push libwvdrmmediacrypto_hidl_test
try_adb_push libwvdrmmediacrypto_test
try_adb_push license_keys_unittest
try_adb_push license_unittest
try_adb_push oemcrypto_test
try_adb_push policy_engine_constraints_unittest
try_adb_push policy_engine_unittest
try_adb_push request_license_test
try_adb_push service_certificate_unittest
try_adb_push timer_unittest
try_adb_push usage_table_header_unittest
# Run the tests using run_all_unit_tests.sh
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine

View File

@@ -52,7 +52,8 @@ LOCAL_CFLAGS += -DUNIT_TEST
LOCAL_MODULE_OWNER := widevine
LOCAL_PROPRIETARY_MODULE := true
# When built, explicitly put it in the DATA/bin directory.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/bin
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
LOCAL_MODULE_TARGET_ARCH := arm x86 mips

View File

@@ -46,7 +46,8 @@ LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_OWNER := widevine
LOCAL_PROPRIETARY_MODULE := true
# When built, explicitly put it in the DATA/bin directory.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/bin
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
LOCAL_MODULE_TARGET_ARCH := arm x86 mips
@@ -111,7 +112,8 @@ LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_OWNER := widevine
LOCAL_PROPRIETARY_MODULE := true
# When built, explicitly put it in the DATA/bin directory.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/bin
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
LOCAL_MODULE_TARGET_ARCH := arm x86 mips

View File

@@ -46,7 +46,8 @@ LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_OWNER := widevine
LOCAL_PROPRIETARY_MODULE := true
# When built, explicitly put it in the DATA/bin directory.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/bin
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
LOCAL_MODULE_TARGET_ARCH := arm x86 mips
@@ -112,7 +113,8 @@ LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_OWNER := widevine
LOCAL_PROPRIETARY_MODULE := true
# When built, explicitly put it in the DATA/bin directory.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/bin
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
LOCAL_MODULE_TARGET_ARCH := arm x86 mips

View File

@@ -7,7 +7,8 @@ LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_OWNER := widevine
LOCAL_PROPRIETARY_MODULE := true
# When built, explicitly put it in the DATA/bin directory.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/bin
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
LOCAL_MODULE_TARGET_ARCH := arm x86 mips

View File

@@ -19,10 +19,12 @@ fi
adb_shell_run() {
local test_file=$1
shift
if adb shell ls /data/widevine_tests/$test_file &> /dev/null; then
test_file=/data/widevine_tests/$test_file
if adb shell ls /data/bin/$test_file &> /dev/null; then
test_file=/data/bin/$test_file
else
test_file=/vendor/bin/$test_file
echo "Please install the test on the device in /data/bin, "
echo "or begin execution by running ./build_and_run_all_unit_tests.sh"
exit 1
fi
echo $test_file
local tmp_log="$OUT/mediadrmtest.log"
@@ -49,7 +51,7 @@ if [ -z "$ANDROID_BUILD_TOP" ]; then
fi
echo "waiting for device"
ADB_OUTPUT=`adb root && adb wait-for-device remount`
ADB_OUTPUT=`adb root && echo ". " && adb wait-for-device remount`
echo $ADB_OUTPUT
if echo $ADB_OUTPUT | grep -qi "verity"; then
echo
@@ -62,32 +64,40 @@ fi
# Disable DroidGuard to prevent provisioning collisions
set_droidguard disable
# Run oemcrypto tests first due to historical test order issues
adb_shell_run oemcrypto_test \
GTEST_FILTER="$GTEST_FILTER:*Level1Required" FORCE_LEVEL3_OEMCRYPTO=yes
adb_shell_run oemcrypto_test
# Run request_license_test next to ensure device is provisioned
adb_shell_run request_license_test
# cdm_extended_duration_test takes >30 minutes to run.
# adb_shell_run cdm_extended_duration_test
adb_shell_run policy_engine_unittest
adb_shell_run policy_engine_constraints_unittest
adb_shell_run libwvdrmmediacrypto_test
adb_shell_run libwvdrmmediacrypto_hidl_test
adb_shell_run libwvdrmdrmplugin_test
adb_shell_run libwvdrmdrmplugin_hidl_test
# Additional tests
adb_shell_run base64_test
adb_shell_run buffer_reader_test
adb_shell_run cdm_engine_test
adb_shell_run cdm_session_unittest
adb_shell_run file_store_unittest
adb_shell_run file_utils_unittest
adb_shell_run license_unittest
adb_shell_run license_keys_unittest
adb_shell_run initialization_data_unittest
adb_shell_run device_files_unittest
adb_shell_run usage_table_header_unittest
adb_shell_run service_certificate_unittest
adb_shell_run timer_unittest
adb_shell_run buffer_reader_test
adb_shell_run distribution_test
adb_shell_run event_metric_test
adb_shell_run file_store_unittest
adb_shell_run file_utils_unittest
adb_shell_run http_socket_test
adb_shell_run initialization_data_unittest
adb_shell_run libwvdrmdrmplugin_hidl_test
adb_shell_run libwvdrmdrmplugin_test
adb_shell_run libwvdrmmediacrypto_hidl_test
adb_shell_run libwvdrmmediacrypto_test
adb_shell_run license_keys_unittest
adb_shell_run license_unittest
adb_shell_run policy_engine_constraints_unittest
adb_shell_run policy_engine_unittest
adb_shell_run service_certificate_unittest
adb_shell_run timer_unittest
adb_shell_run usage_table_header_unittest
# Run the non-Treble test on non-Treble devices
if adb shell ls /vendor/lib/mediadrm/libwvdrmengine.so &> /dev/null ||

View File

@@ -3,6 +3,9 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
# When built, explicitly put it in the data/app partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-java-files-under, src)

View File

@@ -11,6 +11,9 @@ LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
LOCAL_DEX_PREOPT := false
# When built, explicitly put it in the data/app partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# TODO: This test app depends on framework implementation details.
# LOCAL_SDK_VERSION := current

View File

@@ -34,7 +34,8 @@ LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_OWNER := widevine
LOCAL_PROPRIETARY_MODULE := true
# When built, explicitly put it in the DATA/bin directory.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/bin
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
LOCAL_MODULE_TARGET_ARCH := arm x86 mips
@@ -82,7 +83,8 @@ LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_OWNER := widevine
LOCAL_PROPRIETARY_MODULE := true
# When built, explicitly put it in the DATA/bin directory.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/bin
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
LOCAL_MODULE_TARGET_ARCH := arm x86 mips