Fix exit status of `run` scripts executing more than one test.
For some ART run-tests, the `run` script executes more than one
instance of the test (e.g. test/004-ThreadStress/run executes the
ThreadStress test twice: the first time as a normal run, the second
time in locks-only mode with stack-dump lock profiling). However,
these tests were returning the exit status of last test executed,
which could hide a potential earlier failure. This change ensure we
return the first failing exit status, if any.
Test: art/test/testrunner/testrunner.py
Change-Id: I5e4e4cc7d9311fe15637ea2f5248a0e9f2432d61
diff --git a/test/118-noimage-dex2oat/run b/test/118-noimage-dex2oat/run
index 07bdb08..e1e2577 100644
--- a/test/118-noimage-dex2oat/run
+++ b/test/118-noimage-dex2oat/run
@@ -48,15 +48,23 @@
# Make sure we can run without an oat file.
echo "Run -Xnoimage-dex2oat"
${RUN} ${flags} ${bpath_arg} --runtime-option -Xnoimage-dex2oat --runtime-option -Xnodex2oat
+return_status1=$?
# Make sure we cannot run without an oat file without fallback.
echo "Run -Xnoimage-dex2oat -Xno-dex-file-fallback"
-${RUN} ${flags} ${bpath_arg} --runtime-option -Xnoimage-dex2oat --runtime-option -Xnodex2oat --runtime-option -Xno-dex-file-fallback
+${RUN} ${flags} ${bpath_arg} --runtime-option -Xnoimage-dex2oat --runtime-option -Xnodex2oat \
+ --runtime-option -Xno-dex-file-fallback
+return_status2=$?
# Make sure we can run with the oat file.
echo "Run -Ximage-dex2oat"
${RUN} ${flags} ${bpath_arg} --runtime-option -Ximage-dex2oat
+return_status3=$?
# Make sure we can run with the default settings.
echo "Run default"
${RUN} ${flags} ${bpath_arg}
+return_status4=$?
+
+# Make sure we don't silently ignore an early failure.
+(exit $return_status1) && (exit $return_status2) && (exit $return_status3) && (exit $return_status4)