(This is a merge of wvgerrit/24922) This contains several fixes and improvements to the build_and_run_all_unit_tests.sh and run_all_unit_tests.sh scripts: * All tests are now identified as vendor binaries and thus are stored in the /vendor/bin/ directory instead of /system/bin/. Previously, some tests had moved to /vendor/bin/ but the scripts had not been updated, causing these tests to fail to run. * The -j parameter can now be passed to build_and_run_all_unit_tests.sh, for those who want to speed up their build by using multiple cores. * The 64-bit library directories are now added to the library search path, in anticipation of devices with 64-bit DRM Plugins. * Checking for Verity protection is now done in build_and_run_all_unit_tests.sh (which is the script that actually modifies the file system) instead of just in run_all_unit_tests.sh. * The library search path is no longer set unnecessarily for libwvdrmengine_hidl_test. * The Treble-only tests and non-Treble-only tests now only run on devices that meet their respective criteria. Bug: 36071236 Test: Ran build_and_run_all_unit_tests.sh Change-Id: Iea236880c4445858111c801dfa278a528bca0f6c
102 lines
3.2 KiB
Bash
Executable File
102 lines
3.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
if [ -z "$ANDROID_BUILD_TOP" ]; then
|
|
echo "Android build environment not set"
|
|
exit -1
|
|
fi
|
|
|
|
# Read arguments in case the user wants to do a multicore build
|
|
NUM_CORES=1
|
|
while getopts "j:" opt; do
|
|
case $opt in
|
|
j)
|
|
NUM_CORES=$OPTARG
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Define the relevant aliases
|
|
. $ANDROID_BUILD_TOP/build/envsetup.sh
|
|
|
|
# Build all the targets
|
|
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine
|
|
pwd
|
|
mm -j $NUM_CORES || mma -j $NUM_CORES
|
|
|
|
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine/test/unit
|
|
pwd
|
|
mm -j $NUM_CORES || mma -j $NUM_CORES
|
|
|
|
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine/cdm/test
|
|
pwd
|
|
mm -j $NUM_CORES || mma -j $NUM_CORES
|
|
|
|
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine/mediacrypto/test
|
|
pwd
|
|
mm -j $NUM_CORES || mma -j $NUM_CORES
|
|
|
|
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine/mediadrm/test
|
|
pwd
|
|
mm -j $NUM_CORES || mma -j $NUM_CORES
|
|
|
|
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine/oemcrypto/test
|
|
pwd
|
|
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`
|
|
echo $ADB_OUTPUT
|
|
if echo $ADB_OUTPUT | grep -qi "verity"; then
|
|
echo
|
|
echo "ERROR: This device has Verity enabled. build_and_run_all_unit_tests.sh "
|
|
echo "does not work if Verity is enabled. Please disable Verity with"
|
|
echo "\"adb disable-verity\" and try again."
|
|
exit -1
|
|
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.
|
|
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
|
|
fi
|
|
}
|
|
|
|
# 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/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
|
|
|
|
# Run the tests using run_all_unit_tests.sh
|
|
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine
|
|
./run_all_unit_tests.sh
|