Files
android/libwvdrmengine/build_and_run_all_unit_tests.sh
Rahul Frias 1884cf738e Merges to android Pi release (part 8)
These are a set of CLs merged from the wv cdm repo to the android
	   repo.

* Android build fixes

  Author: Rahul Frias <rfrias@google.com>

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

* Address android compilation errors and warnings

  Author: Rahul Frias <rfrias@google.com>

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

* Gyp cleanup and OpenSSL v10.1 support.

  Author: Gene Morgan <gmorgan@google.com>

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

  OpenSSL 10.1 has a small number of incompatible changes.

  A desktop system upgrade exposed some issue in the build scripts.
  Specifically, the linux build was using both third_party/protobufs (2.6.1)
  and the version installed on the system (3.0 in this case). The linux
  cdm.gyp depended on cdm/cdm.gyp which caused that plus some
  additional issues.

  These changes are necessary to support g++ version:
    g++ (Debian 6.3.0-18) 6.3.0 20170516

  Also did some cosmetic rework on run_current_tests to make it easier
  to figure out what is going on when something fails.

  Also tweaked some of the compiler settings for g++ support (revisit
  this later).

* Refactored Service Certificate encryption to allow encryption of arbitrary data.

  Author: Thomas Inskip <tinskip@google.com>

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

* Send cdm test requests to UAT.

  Author: Jeff Fore <jfore@google.com>

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

  This change resolves the all of the
  CdmDecryptTest/CdmTestWithDecryptParam.DecryptToClearBuffer
  tests.

  The license servers will return different keys and keyids.
  Sending the request to staging returned key ids and keys that were
  not matching what was expected in the unit tests.

* Fix for building L3 OEMCrypto with clang and libc++

  Author: yucliu <yucliu@google.com>

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

  1. Include <time.h> for time(time_t*).
  2. Create endian check union on stack. Clang may create const union
  somewhere else, which may cause crash.

* Remove error result when a sublicense session does
  not exist. This is not considered an error.

  Author: Jeff Fore <jfore@google.com>

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

* Set default mock handler for GetSupportedCertificateTypes
  for all unit tests and removed the use of StrictMock from
  MockCryptoSession.

  Author: Jeff Fore <jfore@google.com>

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

  The handler for this was only set for one test and resulted
  in a number of failures.

* Set default handler for GetHdcpCapabilities. For
  now the default action is to call the real
  GetHdcpCapabilities of crypto_session.

  Author: Jeff Fore <jfore@google.com>

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

  I also changed the mock to a NiceMock to silence
  responses to unexpected calls to GetHdcpCapabilities.

  The default handler can be overridden as needed in
  the individual tests.

  This resolves the policy engine test failures.

* Finalize merge of cdm_partner_3.4 to master.

  Author: Gene Morgan <gmorgan@google.com>

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

  This is the final set of updates to merge all v3.4.1
  changes into master.

* Embedded license: Sublicense rotation.

  Author: Jeff Fore <jfore@google.com>

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

  Handle sublicense rotation event.

* Embedded license: Initial license phase.

  Author: Jeff Fore <jfore@google.com>

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

  Initial license phase - key loading subsession.

* Embedded license: generate session data.

  Author: Jeff Fore <jfore@google.com>

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

  Generate session data and add it to the license request for
  any embedded license material.

* Resolve missing symbol when building cd-cdm

  Author: Jeff Fore <jfore@google.com>

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

* C++11: Replace OVERRIDE def with override keyword

  Author: Gene Morgan <gmorgan@google.com>

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

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

Change-Id: I37d0cb17f255ac6389030047d616ad69f895748c
2018-01-16 19:29:39 -08:00

111 lines
3.0 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 && echo ". " && 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 try to push it to /data/bin.
# If that fails, an error message will be printed.
try_adb_push() {
# 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 base64_test
try_adb_push buffer_reader_test
try_adb_push cdm_engine_test
try_adb_push cdm_feature_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
try_adb_push wv_cdm_metrics_test
# Run the tests using run_all_unit_tests.sh
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine
./run_all_unit_tests.sh