Merge "Allow tests to take serial number as a parameter"
This commit is contained in:
@@ -7,13 +7,18 @@ if [ -z "$ANDROID_BUILD_TOP" ]; then
|
|||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Read arguments in case the user wants to do a multicore build
|
# Read arguments in case the user wants to do a multicore build or
|
||||||
|
# copy files to a specific android device by providing a serial number
|
||||||
NUM_CORES=1
|
NUM_CORES=1
|
||||||
while getopts "j:" opt; do
|
SERIAL_NUM=""
|
||||||
|
while getopts "j:s:" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
j)
|
j)
|
||||||
NUM_CORES=$OPTARG
|
NUM_CORES=$OPTARG
|
||||||
;;
|
;;
|
||||||
|
s)
|
||||||
|
SERIAL_NUM="-s $OPTARG"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -47,13 +52,13 @@ mm -j $NUM_CORES || mma -j $NUM_CORES
|
|||||||
|
|
||||||
# Detect the device and check if Verity is going to stop the script from working
|
# Detect the device and check if Verity is going to stop the script from working
|
||||||
echo "waiting for device"
|
echo "waiting for device"
|
||||||
ADB_OUTPUT=`adb root && echo ". " && adb wait-for-device remount`
|
ADB_OUTPUT=`adb $SERIAL_NUM root && echo ". " && adb $SERIAL_NUM wait-for-device remount`
|
||||||
echo $ADB_OUTPUT
|
echo $ADB_OUTPUT
|
||||||
if echo $ADB_OUTPUT | grep -qi "verity"; then
|
if echo $ADB_OUTPUT | grep -qi "verity"; then
|
||||||
echo
|
echo
|
||||||
echo "ERROR: This device has Verity enabled. build_and_run_all_unit_tests.sh "
|
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 "does not work if Verity is enabled. Please disable Verity with"
|
||||||
echo "\"adb disable-verity\" and try again."
|
echo "\"adb $SERIAL_NUM disable-verity\" and try again."
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -70,8 +75,8 @@ try_adb_push() {
|
|||||||
echo "I think it should be in $OUT/data/bin"
|
echo "I think it should be in $OUT/data/bin"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adb shell mkdir -p /data/bin
|
adb $SERIAL_NUM shell mkdir -p /data/bin
|
||||||
adb push $test_file /data/bin/$1
|
adb $SERIAL_NUM push $test_file /data/bin/$1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Push the tests to the device
|
# Push the tests to the device
|
||||||
@@ -83,7 +88,6 @@ try_adb_push cdm_extended_duration_test
|
|||||||
try_adb_push cdm_session_unittest
|
try_adb_push cdm_session_unittest
|
||||||
try_adb_push counter_metric_unittest
|
try_adb_push counter_metric_unittest
|
||||||
try_adb_push crypto_session_unittest
|
try_adb_push crypto_session_unittest
|
||||||
try_adb_push generic_crypto_unittest
|
|
||||||
try_adb_push device_files_unittest
|
try_adb_push device_files_unittest
|
||||||
try_adb_push distribution_unittest
|
try_adb_push distribution_unittest
|
||||||
try_adb_push event_metric_unittest
|
try_adb_push event_metric_unittest
|
||||||
@@ -111,4 +115,4 @@ try_adb_push wv_cdm_metrics_test
|
|||||||
|
|
||||||
# Run the tests using run_all_unit_tests.sh
|
# Run the tests using run_all_unit_tests.sh
|
||||||
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine
|
cd $ANDROID_BUILD_TOP/vendor/widevine/libwvdrmengine
|
||||||
./run_all_unit_tests.sh
|
./run_all_unit_tests.sh $SERIAL_NUM
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Read arguments in case the user wants to copy files to a specific
|
||||||
|
# android device by providing a serial number
|
||||||
|
SERIAL_NUM=""
|
||||||
|
while getopts "j:s:" opt; do
|
||||||
|
case $opt in
|
||||||
|
s)
|
||||||
|
SERIAL_NUM="-s $OPTARG"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
final_result=0
|
final_result=0
|
||||||
failed_tests=()
|
failed_tests=()
|
||||||
|
|
||||||
@@ -19,7 +30,7 @@ fi
|
|||||||
adb_shell_run() {
|
adb_shell_run() {
|
||||||
local test_file=$1
|
local test_file=$1
|
||||||
shift
|
shift
|
||||||
if adb shell ls /data/bin/$test_file &> /dev/null; then
|
if adb $SERIAL_NUM shell ls /data/bin/$test_file &> /dev/null; then
|
||||||
test_file=/data/bin/$test_file
|
test_file=/data/bin/$test_file
|
||||||
else
|
else
|
||||||
echo "Please install the test on the device in /data/bin, "
|
echo "Please install the test on the device in /data/bin, "
|
||||||
@@ -29,7 +40,7 @@ adb_shell_run() {
|
|||||||
echo "------ Starting: $test_file"
|
echo "------ Starting: $test_file"
|
||||||
local tmp_log="$OUT/mediadrmtest.log"
|
local tmp_log="$OUT/mediadrmtest.log"
|
||||||
local adb_error="[ADB SHELL] $@ $test_file failed"
|
local adb_error="[ADB SHELL] $@ $test_file failed"
|
||||||
adb shell "GTEST_FILTER=$GTEST_FILTER $@ $test_file" \|\| echo "$adb_error" | tee "$tmp_log"
|
adb $SERIAL_NUM shell "GTEST_FILTER=$GTEST_FILTER $@ $test_file" \|\| echo "$adb_error" | tee "$tmp_log"
|
||||||
! grep -Fq "$adb_error" "$tmp_log"
|
! grep -Fq "$adb_error" "$tmp_log"
|
||||||
local result=$?
|
local result=$?
|
||||||
if [ $result -ne 0 ]; then
|
if [ $result -ne 0 ]; then
|
||||||
@@ -42,7 +53,7 @@ adb_shell_run() {
|
|||||||
# Disabling DroidGuard during the test run prevents concurrency issues
|
# Disabling DroidGuard during the test run prevents concurrency issues
|
||||||
# with provisioning status.
|
# with provisioning status.
|
||||||
set_droidguard() {
|
set_droidguard() {
|
||||||
adb shell pm $1 com.google.android.gms/com.google.android.gms.droidguard.DroidGuardService
|
adb $SERIAL_NUM shell pm $1 com.google.android.gms/com.google.android.gms.droidguard.DroidGuardService
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$ANDROID_BUILD_TOP" ]; then
|
if [ -z "$ANDROID_BUILD_TOP" ]; then
|
||||||
@@ -51,13 +62,13 @@ if [ -z "$ANDROID_BUILD_TOP" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "waiting for device"
|
echo "waiting for device"
|
||||||
ADB_OUTPUT=`adb root && echo ". " && adb wait-for-device remount`
|
ADB_OUTPUT=`adb $SERIAL_NUM root && echo ". " && adb $SERIAL_NUM wait-for-device remount`
|
||||||
echo $ADB_OUTPUT
|
echo $ADB_OUTPUT
|
||||||
if echo $ADB_OUTPUT | grep -qi "verity"; then
|
if echo $ADB_OUTPUT | grep -qi "verity"; then
|
||||||
echo
|
echo
|
||||||
echo "ERROR: This device has Verity enabled. run_all_unit_tests.sh does not "
|
echo "ERROR: This device has Verity enabled. run_all_unit_tests.sh does not "
|
||||||
echo "work if Verity is enabled. Please disable Verity with"
|
echo "work if Verity is enabled. Please disable Verity with"
|
||||||
echo "\"adb disable-verity\" and try again."
|
echo "\"adb $SERIAL_NUM disable-verity\" and try again."
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -108,15 +119,15 @@ adb_shell_run value_metric_unittest
|
|||||||
adb_shell_run wv_cdm_metrics_test
|
adb_shell_run wv_cdm_metrics_test
|
||||||
|
|
||||||
# Run the non-Treble test on non-Treble devices
|
# Run the non-Treble test on non-Treble devices
|
||||||
if adb shell ls /vendor/lib/mediadrm/libwvdrmengine.so &> /dev/null ||
|
if adb $SERIAL_NUM shell ls /vendor/lib/mediadrm/libwvdrmengine.so &> /dev/null ||
|
||||||
adb shell ls /vendor/lib64/mediadrm/libwvdrmengine.so &> /dev/null; then
|
adb $SERIAL_NUM shell ls /vendor/lib64/mediadrm/libwvdrmengine.so &> /dev/null; then
|
||||||
library_path="/vendor/lib/mediadrm/:/vendor/lib64/mediadrm/"
|
library_path="/vendor/lib/mediadrm/:/vendor/lib64/mediadrm/"
|
||||||
adb_shell_run libwvdrmengine_test LD_LIBRARY_PATH=$library_path
|
adb_shell_run libwvdrmengine_test LD_LIBRARY_PATH=$library_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the Treble test on Treble devices
|
# Run the Treble test on Treble devices
|
||||||
if adb shell ls /vendor/lib/libwvhidl.so &> /dev/null ||
|
if adb $SERIAL_NUM shell ls /vendor/lib/libwvhidl.so &> /dev/null ||
|
||||||
adb shell ls /vendor/lib64/libwvhidl.so &> /dev/null; then
|
adb $SERIAL_NUM shell ls /vendor/lib64/libwvhidl.so &> /dev/null; then
|
||||||
adb_shell_run libwvdrmengine_hidl_test
|
adb_shell_run libwvdrmengine_hidl_test
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user