From f3284e0d523db5012a1c5fadd707c33a62af8599 Mon Sep 17 00:00:00 2001 From: Gabriel Russell Date: Wed, 6 Feb 2019 13:39:22 -0500 Subject: SERVER-35628 check that the android embedded tests report "All tests in all suites passed --- buildscripts/runandroidsim.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/buildscripts/runandroidsim.sh b/buildscripts/runandroidsim.sh index 1efb9e2aabd..6dd084a7f9d 100755 --- a/buildscripts/runandroidsim.sh +++ b/buildscripts/runandroidsim.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash if [ "$#" -lt "5" ]; then echo "usage:" @@ -8,6 +8,7 @@ fi set -o verbose set -o errexit +set -o pipefail ANDROID_SDK=$1 shift @@ -60,8 +61,18 @@ echo "Copying the test to the virtual device" $ANDROID_SDK/platform-tools/adb push $DIRECTORY /data echo "Running the test on the virtual device" -$ANDROID_SDK/platform-tools/adb shell /data/$(basename $DIRECTORY)/$TEST_PATH_IN_DIRECTORY "$@" - -# Do not add additional statements after the above adb invocation without +$ANDROID_SDK/platform-tools/adb shell /data/$(basename $DIRECTORY)/$TEST_PATH_IN_DIRECTORY "$@" | tee android_sim_test_output.txt 2>&1 + +# On the android sim ( possibly on nomral android as well ) if a program fails its runtime link, +# for example because of a missing library, it will have an exit code of 0. In which case the +# android_sim_test_output.txt file will not contian the test output, but instead will contain +# "CANNOT LINK EXECUTABLE" +# So, once we're here in this script, the previous adb shell test command has either run +# successfully or failed to link. If it ran with errors, this script would have returned already +# because of the errexit. +# We test the output file to disambiguate +grep -q 'SUCCESS - All tests in all suites passed' android_sim_test_output.txt + +# Do not add additional statements after the above command invocation without # forwarding its exit status or you will cause failing tests to appear # to succeed. -- cgit v1.2.1