Files
android/libwvdrmengine/build_and_run_all_unit_tests.sh
Rahul Frias 0419b55222 Merges to android Pi release (part: 1)
Below are a set of CLs being merged from the wv cdm repo to the android repo.

* Fix handling of OEM Cert public key.

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/27921 ]

  This is a potential fix for b/36656190. Set aside public
  key on first call to get the public key, and use it afterwards.
  This gets rid of extra calls to OEMCrypto_GetOEMPublicCertificate(),
  which has side-effect of staging the OEM private key.

  This also fixes a problem where the public cert string was
  not being trimmed to match the size returned by
  OEMCrypto_GetOEMPublicCertificate().

* Complete provisioning request/response for Provisioning 3.0

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27780 ]

  Fix bug on provisioning request path where GenerateDerivedKeys()
  was being called when preparing to generate the signature.

  Add message signature verification, and call correct OEMCrypto
  routine to rewrap the private key (OEMCrypto_RewrapDeviceRSAKey30).

* Implement Cdm::deleteAllUsageRecords()

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27780 ]

  Delete all usage records for current origin.  Removes usage
  records from file system and retains the PSTs.  The deletes
  any usage entries matching those PSTs held by OEMCrypto.

  BUG: 35319024

* Remove stringencoders library from third_party.

  Author: Jacob Trimble <modmaker@google.com>

  [ Merge of http://go/wvgerrit/27585 ]

  We have a fork of the stringencoders library that we use for base64
  encoding.  This reimplements base64 encoding to remove the extra
  dependency and to reduce the amount of code.

* Add Cdm::deleteUsageRecord() based on key_set_id.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27605 ]

  Delete specified usage record from file system usage info and
  from OEMCrypto.

  BUG: 35319024

* Modifiable OEMCrypto

  Author: Fred Gylys-Colwell <fredgc@google.com>

  [ Merge of http://go/wvgerrit/24729 ]

  This CL adds a new variant of the OEMCrypto mock code that adjusts its
  behavior based on a configuration file.  This is intended for
  testing.

  For example, a tester can set current_hdcp to 2 in the options.txt
  file, push it to the device, and verify that a license is granted for
  HDCP 2.0.  Then the tester can edit the value of current_hdcp to 1 and
  push the file to the device.  Playback should stop because the license
  is no longer valid.

  This variant uses a real level 1 liboemcrypto.so to push data to a
  secure buffer.  That means we can test playback for a license that
  requires secure buffers on an Android device with real secure buffers.

  BUG: 35141278
  BUG: 37353534

BUG: 71650075
Test: Not currently passing. Will be addressed in a subsequent
      commit in the chain.

Change-Id: I58443c510919e992bb455192e70373490a00e2b6
2018-01-16 19:21:54 -08:00

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