summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Russell <gabriel.russell@mongodb.com>2019-02-06 13:39:22 -0500
committerGabriel Russell <gabriel.russell@mongodb.com>2019-03-22 13:08:40 -0400
commitf3284e0d523db5012a1c5fadd707c33a62af8599 (patch)
treecfa286bf0d110c09afd3f1f56fc3e07d333de284
parent5bf7bd3ba234b851d7563bbcb799f748ee4dfc47 (diff)
downloadmongo-f3284e0d523db5012a1c5fadd707c33a62af8599.tar.gz
SERVER-35628 check that the android embedded tests report "All tests in all suites passed
-rwxr-xr-xbuildscripts/runandroidsim.sh19
1 files 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.