Files
android/libwvdrmengine/build_and_run_all_unit_tests.sh
Rahul Frias 5da8da58f6 Corrections for big usage table support in L3
[ Merge of http://go/wvgerrit/26421 ]

* Corrects usage_table_header lifetime management. Earlier the
  UsageTableHeader class was a singleton tied to the CdmEngine lifetime.
  With SPOIDs there might be multiple concurrent CdmEngine objects.
  The UsageTableHeader class is now associated with OEMCrypto
  lifetime. There are two UsageTableHeader objects one for each L1 and L3.
  These get allocated/deallocated on OEMCrypto Initialization/Termination
  respectively.
* UsageTableHeader requires OEMCrypto, file read/writes and
  metric gathering to perform its required functionality. Because of the
  lifetime changes, CryptoSession, DeviceFiles and MetricsGroup objects
  need to passed to the methods rather than at Creation time.
* Miscellaneous fixes, when moving or deleteing entries.
* Adds usage_table_header_unittests.
* Addresses failures with request_license_test with secure stop in L3.

b/36858906
b/36855557
b/36048120
b/38341136
b/37100505
b/35946047

Test: Verified by unit and integration tests. Added new
      usage_table_header_unittests

Change-Id: I20e396ab2c0afbd14372dd93b969e5b0f1ccd291
2017-05-31 00:37:58 -07:00

103 lines
3.3 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/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
# Run the tests using run_all_unit_tests.sh
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine
./run_all_unit_tests.sh