Revert^2 "Ensure that run-test preserves exit status"

We failed to update the run script for test 134 which would exit
non-zero in cases where dex2oat is disabled. This caused the test to
fail in some configurations.

This reverts commit d8c88c7125b1de357f67d61c31eeef2ecfe17dd9.

Reason for revert: Fixed issue with test 134
Test: ./test/testrunner/testrunner.py --host -t 134-nodex2oat-nofallback --no-prebuild --no-relocate

Change-Id: I34d0cf1b8968fd7c07f907b9453ddca90ea03605
diff --git a/test/030-bad-finalizer/expected.txt b/test/030-bad-finalizer/expected.txt
index 74e208c..0aca6f2 100644
--- a/test/030-bad-finalizer/expected.txt
+++ b/test/030-bad-finalizer/expected.txt
@@ -2,3 +2,4 @@
 Finalizer started and spinning...
 Finalizer done spinning.
 Finalizer sleeping forever now.
+exit status: 2
diff --git a/test/030-bad-finalizer/run b/test/030-bad-finalizer/run
new file mode 100755
index 0000000..7a0d0d0
--- /dev/null
+++ b/test/030-bad-finalizer/run
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Squash the exit status and put it in expected
+./default-run "$@"
+echo "exit status:" $?
diff --git a/test/034-call-null/expected.txt b/test/034-call-null/expected.txt
index 4e0281e..11aefde 100644
--- a/test/034-call-null/expected.txt
+++ b/test/034-call-null/expected.txt
@@ -1,2 +1,3 @@
 Exception in thread "main" java.lang.NullPointerException: Attempt to invoke direct method 'void Main.doStuff(int, int[][], java.lang.String, java.lang.String[][])' on a null object reference
 	at Main.main(Main.java:26)
+exit status: 1
diff --git a/test/034-call-null/run b/test/034-call-null/run
new file mode 100755
index 0000000..7a0d0d0
--- /dev/null
+++ b/test/034-call-null/run
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Squash the exit status and put it in expected
+./default-run "$@"
+echo "exit status:" $?
diff --git a/test/038-inner-null/expected.txt b/test/038-inner-null/expected.txt
index 2e92564..d148eff 100644
--- a/test/038-inner-null/expected.txt
+++ b/test/038-inner-null/expected.txt
@@ -2,3 +2,4 @@
 Exception in thread "main" java.lang.NullPointerException: Attempt to invoke virtual method 'void Main$Blort.repaint()' on a null object reference
 	at Main$Special.callInner(Main.java:31)
 	at Main.main(Main.java:20)
+exit status: 1
diff --git a/test/038-inner-null/run b/test/038-inner-null/run
new file mode 100755
index 0000000..7a0d0d0
--- /dev/null
+++ b/test/038-inner-null/run
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Squash the exit status and put it in expected
+./default-run "$@"
+echo "exit status:" $?
diff --git a/test/054-uncaught/expected.txt b/test/054-uncaught/expected.txt
index 7d7f03c..878260a 100644
--- a/test/054-uncaught/expected.txt
+++ b/test/054-uncaught/expected.txt
@@ -18,3 +18,4 @@
 java.lang.NullPointerException: Hi diddly-ho, neighborino.
 	at Main.catchTheUncaught(Main.java:63)
 	at Main.main(Main.java:26)
+exit status: 1
diff --git a/test/054-uncaught/run b/test/054-uncaught/run
new file mode 100755
index 0000000..7a0d0d0
--- /dev/null
+++ b/test/054-uncaught/run
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Squash the exit status and put it in expected
+./default-run "$@"
+echo "exit status:" $?
diff --git a/test/134-nodex2oat-nofallback/run b/test/134-nodex2oat-nofallback/run
index 38b4adb..33265ac 100755
--- a/test/134-nodex2oat-nofallback/run
+++ b/test/134-nodex2oat-nofallback/run
@@ -18,3 +18,5 @@
 
 # Make sure we cannot run without an oat file without fallback.
 ${RUN} ${flags} --runtime-option -Xnodex2oat --runtime-option -Xno-dex-file-fallback
+# Suppress the exit value. This isn't expected to be successful.
+echo "Exit status:" $?
diff --git a/test/714-invoke-custom-lambda-metafactory/expected.txt b/test/714-invoke-custom-lambda-metafactory/expected.txt
index cbe9840..54b6c24 100644
--- a/test/714-invoke-custom-lambda-metafactory/expected.txt
+++ b/test/714-invoke-custom-lambda-metafactory/expected.txt
@@ -2,3 +2,4 @@
 	at Main.main(Main.java:25)
 Caused by: java.lang.NullPointerException: Bootstrap method returned null
 	... 1 more
+exit status: 1
diff --git a/test/714-invoke-custom-lambda-metafactory/run b/test/714-invoke-custom-lambda-metafactory/run
new file mode 100755
index 0000000..7a0d0d0
--- /dev/null
+++ b/test/714-invoke-custom-lambda-metafactory/run
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Squash the exit status and put it in expected
+./default-run "$@"
+echo "exit status:" $?
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 89efd7c..bb6ace1 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -887,11 +887,14 @@
       adb push $cmdfile $DEX_LOCATION/cmdline.sh > /dev/null 2>&1
     fi
 
+    exit_status=0
     if [ "$DRY_RUN" != "y" ]; then
       adb shell sh $DEX_LOCATION/cmdline.sh
+      exit_status=$?
     fi
 
     rm -f $cmdfile
+    exit $exit_status
 else
     # Host run.
     export ANDROID_PRINTF_LOG=brief
@@ -997,10 +1000,12 @@
         trap 'kill -INT -$pid' INT
         $cmdline "$@" 2>&1 & pid=$!
         wait $pid
+        exit_value=$?
         # Add extra detail if time out is enabled.
-        if [ ${PIPESTATUS[0]} = 124 ] && [ "$TIME_OUT" = "timeout" ]; then
+        if [ $exit_value = 124 ] && [ "$TIME_OUT" = "timeout" ]; then
           echo -e "\e[91mTEST TIMED OUT!\e[0m" >&2
         fi
+        exit $exit_value
       else
         # With a thread dump that uses gdb if a timeout.
         trap 'kill -INT -$pid' INT
@@ -1023,6 +1028,7 @@
             # The test timed out.
             echo -e "\e[91mTEST TIMED OUT!\e[0m" >&2
           fi
+          exit $test_exit_status
         fi
       fi
     fi