Modify android/run_all_unit_tests.sh to continue on error

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13840/

Change-Id: Iefd2c6c38dcbec1571f5965eb7e6b30e011cf65b
This commit is contained in:
Kongqun Yang
2015-03-24 18:38:07 -07:00
parent c47712f5a3
commit 308ac24913

View File

@@ -1,13 +1,19 @@
#!/bin/sh
set -e
final_result=0
failed_tests=()
# Execute a command in "adb shell" and capture the result.
adb_shell_run() {
local tmp_log="$OUT/mediadrmtest.log"
local adb_error="[ADB SHELL] $1 failed"
adb shell $1 \|\| echo "$adb_error" | tee "$tmp_log"
local adb_error="[ADB SHELL] $@ failed"
adb shell $@ \|\| echo "$adb_error" | tee "$tmp_log"
! grep -Fq "$adb_error" "$tmp_log"
local result=$?
if [ $result -ne 0 ]; then
final_result=$result
failed_tests+=("$adb_error")
fi
}
if [ -z "$ANDROID_BUILD_TOP" ]; then
@@ -35,8 +41,13 @@ adb_shell_run /system/bin/device_files_unittest
adb_shell_run /system/bin/timer_unittest
library_path="/system/vendor/lib/mediadrm/ "
adb_shell_run "LD_LIBRARY_PATH=$library_path /system/bin/libwvdrmengine_test"
adb_shell_run LD_LIBRARY_PATH=$library_path /system/bin/libwvdrmengine_test
adb_shell_run "am start com.widevine.test/com.widevine.test.MediaDrmAPITest"
echo "MediaDrm unittests completed successfully!"
adb_shell_run am start com.widevine.test/com.widevine.test.MediaDrmAPITest
if [ $final_result -eq 0 ]; then
echo "MediaDrm unittests completed successfully!"
else
printf '\n%s' "${failed_tests[@]}"
exit $final_result
fi