Fix & Improve Test-Building and -Running Scripts

(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
This commit is contained in:
John W. Bruce
2017-03-29 19:01:04 -07:00
parent 92dff24180
commit f2463075ac
6 changed files with 99 additions and 42 deletions

View File

@@ -19,12 +19,12 @@ fi
adb_shell_run() {
local test_file=$1
shift
if adb shell ls /data/widevine_tests/$test_file; then
if adb shell ls /data/widevine_tests/$test_file &> /dev/null; then
test_file=/data/widevine_tests/$test_file
else
test_file=/system/bin/$test_file
echo $test_file
test_file=/vendor/bin/$test_file
fi
echo $test_file
local tmp_log="$OUT/mediadrmtest.log"
local adb_error="[ADB SHELL] $@ $test_file failed"
adb shell "GTEST_FILTER=$GTEST_FILTER $@ $test_file" \|\| echo "$adb_error" | tee "$tmp_log"
@@ -88,12 +88,18 @@ adb_shell_run buffer_reader_test
adb_shell_run distribution_test
adb_shell_run event_metric_test
library_path="/system/vendor/lib/mediadrm/ "
adb_shell_run libwvdrmengine_test LD_LIBRARY_PATH=$library_path
# Run the non-Treble test on non-Treble devices
if adb shell ls /vendor/lib/mediadrm/libwvdrmengine.so &> /dev/null ||
adb shell ls /vendor/lib64/mediadrm/libwvdrmengine.so &> /dev/null; then
library_path="/vendor/lib/mediadrm/:/vendor/lib64/mediadrm/"
adb_shell_run libwvdrmengine_test LD_LIBRARY_PATH=$library_path
fi
library_path="/system/vendor/lib/hw/ "
adb_shell_run libwvdrmengine_hidl_test LD_LIBRARY_PATH=$library_path
# Run the Treble test on Treble devices
if adb shell ls /vendor/lib/libwvhidl.so &> /dev/null ||
adb shell ls /vendor/lib64/libwvhidl.so &> /dev/null; then
adb_shell_run libwvdrmengine_hidl_test
fi
# Re-enable DroidGuard
set_droidguard enable