Simplify run-test check scripts

The check scripts should use sed to modify the output in place.
(rather then generating temporary files)

The diff execution is moved to "run-test", always operates
on the standard file names, and must always succeed.

Test: ./art/test.py -r --all-target
Change-Id: I92666d78054dc98df07de3f6ed0a047b7f5b8682
diff --git a/TEST_MAPPING b/TEST_MAPPING
index f7fa828..06a8b68 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -413,9 +413,6 @@
       "name": "art-run-test-2231-checker-heap-poisoning[com.google.android.art.apex]"
     },
     {
-      "name": "art-run-test-2232-write-metrics-to-log[com.google.android.art.apex]"
-    },
-    {
       "name": "art-run-test-2233-checker-remove-loop-suspend-check[com.google.android.art.apex]"
     },
     {
@@ -1747,9 +1744,6 @@
       "name": "art-run-test-2231-checker-heap-poisoning"
     },
     {
-      "name": "art-run-test-2232-write-metrics-to-log"
-    },
-    {
       "name": "art-run-test-2233-checker-remove-loop-suspend-check"
     },
     {
@@ -3075,9 +3069,6 @@
       "name": "art-run-test-2231-checker-heap-poisoning"
     },
     {
-      "name": "art-run-test-2232-write-metrics-to-log"
-    },
-    {
       "name": "art-run-test-2233-checker-remove-loop-suspend-check"
     },
     {
diff --git a/test/004-ThreadStress/check b/test/004-ThreadStress/check
index f389e6b..09a15b4 100755
--- a/test/004-ThreadStress/check
+++ b/test/004-ThreadStress/check
@@ -21,10 +21,9 @@
 # $4: Test's actual standard error
 
 # Do not compare numbers, so replace numbers with 'N'.
+sed -i 's/[0-9][0-9]*/N/g' "$2"
+
 # Remove all messages relating to failing to allocate a java-peer for the
 # shutdown thread. This can occasionally happen with this test but it is not
 # something we really need to worry about here.
-sed '-es/[0-9][0-9]*/N/g' "$2" \
-    | diff --strip-trailing-cr -q "$1" - >/dev/null \
-  && grep -v "Exception creating thread peer:" "$4" \
-    | diff --strip-trailing-cr -q "$3" - >/dev/null
+sed -i '/Exception creating thread peer:/d' "$4"
diff --git a/test/099-vmdebug/check b/test/099-vmdebug/check
index 3d92188..c2de81f 100755
--- a/test/099-vmdebug/check
+++ b/test/099-vmdebug/check
@@ -21,7 +21,4 @@
 # $4: Test's actual standard error
 
 # Strip the process pids and line numbers from exact error messages.
-sed -e '/^.*dalvikvm\(\|32\|64\) E.*\] /d' "$4" > "$4.tmp"
-
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4.tmp" >/dev/null
+sed -i '/^.*dalvikvm\(\|32\|64\) E.*\] /d' "$4"
diff --git a/test/1002-notify-startup/check b/test/1002-notify-startup/check
old mode 100644
new mode 100755
index eadb559..d284ede
--- a/test/1002-notify-startup/check
+++ b/test/1002-notify-startup/check
@@ -21,7 +21,4 @@
 # $4: Test's actual standard error
 
 # Oat file manager will complain about duplicate dex files. Ignore.
-sed -e '/.*oat_file_manager.*/d' "$4" > "$4.tmp"
-
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4.tmp" >/dev/null
+sed -i '/.*oat_file_manager.*/d' "$4"
diff --git a/test/115-native-bridge/check b/test/115-native-bridge/check
index e01de91..50edac1 100755
--- a/test/115-native-bridge/check
+++ b/test/115-native-bridge/check
@@ -22,6 +22,4 @@
 
 # ASAN prints a warning here.
 
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
-  && sed -e '/WARNING: ASan is ignoring requested __asan_handle_no_return/,+2d' "$4" \
-       | diff --strip-trailing-cr -q "$3" - >/dev/null
+sed -i '/WARNING: ASan is ignoring requested __asan_handle_no_return/,+2d' "$4"
diff --git a/test/118-noimage-dex2oat/check b/test/118-noimage-dex2oat/check
index 90ffdf8..ec836b8 100755
--- a/test/118-noimage-dex2oat/check
+++ b/test/118-noimage-dex2oat/check
@@ -21,7 +21,4 @@
 # $4: Test's actual standard error
 
 # Strip the process pids and line numbers from exact error messages.
-sed -e '/^dalvikvm.* E.*\] /d' "$4" > "$4.tmp"
-
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4.tmp" >/dev/null
+sed -i '/^dalvikvm.* E.*\] /d' "$4"
diff --git a/test/1337-gc-coverage/check b/test/1337-gc-coverage/check
index 67fcafb..05e0ea3 100755
--- a/test/1337-gc-coverage/check
+++ b/test/1337-gc-coverage/check
@@ -20,6 +20,5 @@
 # $3: Test's expected standard error
 # $4: Test's actual standard error
 
-# Check that the string "error" isn't present
-grep -vq error "$2"  \
-  && diff --strip-trailing-cr -q "$3" "$4" >/dev/null
+# Check that the string "error" isn't present (delete all non-error lines)
+sed -i '/error/!d' "$2"
diff --git a/test/1339-dead-reference-safe/check b/test/1339-dead-reference-safe/check
old mode 100644
new mode 100755
index e7f5f96..3e2b0c6
--- a/test/1339-dead-reference-safe/check
+++ b/test/1339-dead-reference-safe/check
@@ -22,6 +22,4 @@
 
 # DeadReferenceSafe result differs for interpreted mode. A real failure
 # will produce an extra line anyway.
-
-diff --ignore-matching-lines="DeadReferenceSafe count:" -q $1 $2 \
-  && diff --strip-trailing-cr -q "$3" "$4" >/dev/null
+sed -i -E 's/^(.*DeadReferenceSafe count: )[0-9]+(.*)$/\1N\2/' "$2"
diff --git a/test/139-register-natives/check b/test/139-register-natives/check
index f9b35f6..419df00 100755
--- a/test/139-register-natives/check
+++ b/test/139-register-natives/check
@@ -21,7 +21,4 @@
 # $4: Test's actual standard error
 
 # Strip any JNI registration error messages
-sed -e '/jni_entrypoints/d' -e '/jni_internal.cc/d' "$4" > "$4.tmp"
-
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4.tmp" >/dev/null
+sed -i -E '/(jni_entrypoints|jni_internal.cc)/d' "$4"
diff --git a/test/143-string-value/check b/test/143-string-value/check
index 0691e88..1c89716 100755
--- a/test/143-string-value/check
+++ b/test/143-string-value/check
@@ -21,7 +21,4 @@
 # $4: Test's actual standard error
 
 # Strip error log messages.
-sed -e '/^.*dalvikvm\(\|32\|64\) E.*\] /d' "$4" > "$4.tmp"
-
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4.tmp" >/dev/null
+sed -i '/^.*dalvikvm\(\|32\|64\) E.*\] /d' "$4"
diff --git a/test/146-bad-interface/check b/test/146-bad-interface/check
old mode 100644
new mode 100755
index eadb559..d284ede
--- a/test/146-bad-interface/check
+++ b/test/146-bad-interface/check
@@ -21,7 +21,4 @@
 # $4: Test's actual standard error
 
 # Oat file manager will complain about duplicate dex files. Ignore.
-sed -e '/.*oat_file_manager.*/d' "$4" > "$4.tmp"
-
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4.tmp" >/dev/null
+sed -i '/.*oat_file_manager.*/d' "$4"
diff --git a/test/148-multithread-gc-annotations/check b/test/148-multithread-gc-annotations/check
index 67fcafb..05e0ea3 100755
--- a/test/148-multithread-gc-annotations/check
+++ b/test/148-multithread-gc-annotations/check
@@ -20,6 +20,5 @@
 # $3: Test's expected standard error
 # $4: Test's actual standard error
 
-# Check that the string "error" isn't present
-grep -vq error "$2"  \
-  && diff --strip-trailing-cr -q "$3" "$4" >/dev/null
+# Check that the string "error" isn't present (delete all non-error lines)
+sed -i '/error/!d' "$2"
diff --git a/test/172-app-image-twice/check b/test/172-app-image-twice/check
index 228bcb5..7c23c1b 100755
--- a/test/172-app-image-twice/check
+++ b/test/172-app-image-twice/check
@@ -21,5 +21,4 @@
 # $4: Test's actual standard error
 
 # Remove all lines not containing "passed".
-grep "^passed" "$2" | diff --strip-trailing-cr -q "$1" - >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4" >/dev/null
+sed -i '/^passed/!d' "$2"
diff --git a/test/178-app-image-native-method/check b/test/178-app-image-native-method/check
index 45d3654..c683980 100755
--- a/test/178-app-image-native-method/check
+++ b/test/178-app-image-native-method/check
@@ -21,5 +21,4 @@
 # $4: Test's actual standard error
 
 # Filter out error messages for missing native methods.
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
-  && grep -v 'No implementation found for ' "$4" | diff -q "$3" - >/dev/null
+sed -i '/No implementation found for/d' "$4"
diff --git a/test/1931-monitor-events/check b/test/1931-monitor-events/check
old mode 100644
new mode 100755
index 3f799cc..0e638a8
--- a/test/1931-monitor-events/check
+++ b/test/1931-monitor-events/check
@@ -24,5 +24,3 @@
 if [[ "$TEST_RUNTIME" == "jvm" ]]; then
   patch -p0 expected-stdout.txt < jvm-expected.patch >/dev/null
 fi
-
-./default-check "$@"
diff --git a/test/1932-monitor-events-misc/check b/test/1932-monitor-events-misc/check
old mode 100644
new mode 100755
index 0fe4429..c70be42
--- a/test/1932-monitor-events-misc/check
+++ b/test/1932-monitor-events-misc/check
@@ -24,5 +24,3 @@
 if [[ "$TEST_RUNTIME" == "jvm" ]]; then
   patch -p0 expected-stdout.txt < jvm-expected.patch >/dev/null
 fi
-
-./default-check "$@"
diff --git a/test/1936-thread-end-events/check b/test/1936-thread-end-events/check
old mode 100644
new mode 100755
index 0fe4429..c70be42
--- a/test/1936-thread-end-events/check
+++ b/test/1936-thread-end-events/check
@@ -24,5 +24,3 @@
 if [[ "$TEST_RUNTIME" == "jvm" ]]; then
   patch -p0 expected-stdout.txt < jvm-expected.patch >/dev/null
 fi
-
-./default-check "$@"
diff --git a/test/1950-unprepared-transform/check b/test/1950-unprepared-transform/check
index 0fe4429..c70be42 100755
--- a/test/1950-unprepared-transform/check
+++ b/test/1950-unprepared-transform/check
@@ -24,5 +24,3 @@
 if [[ "$TEST_RUNTIME" == "jvm" ]]; then
   patch -p0 expected-stdout.txt < jvm-expected.patch >/dev/null
 fi
-
-./default-check "$@"
diff --git a/test/1953-pop-frame/check b/test/1953-pop-frame/check
index 24bbf07..65e96ff 100755
--- a/test/1953-pop-frame/check
+++ b/test/1953-pop-frame/check
@@ -23,5 +23,6 @@
 # The RI has restrictions and bugs around some PopFrame behavior that ART lacks.
 # See b/116003018. Some configurations cannot handle the class load events in
 # quite the right way so they are disabled there too.
-./default-check "$@" || \
-  (patch -p0 expected-stdout.txt < class-loading-expected.patch >/dev/null && ./default-check "$@")
+if [[ "$TEST_RUNTIME" != "jvm" && "x$VERIFY_SOFT_FAIL" != "xtrue" ]]; then
+  patch -p0 expected-stdout.txt < class-loading-expected.patch
+fi
diff --git a/test/1954-pop-frame-jit/check b/test/1954-pop-frame-jit/check
index e25838a..d2d1843 100755
--- a/test/1954-pop-frame-jit/check
+++ b/test/1954-pop-frame-jit/check
@@ -23,5 +23,6 @@
 # The RI has restrictions and bugs around some PopFrame behavior that ART lacks.
 # See b/116003018. Some configurations cannot handle the class load events in
 # quite the right way so they are disabled there too.
-./default-check "$@" || \
-  (patch -p0 expected-stdout.txt < jvm-expected.patch >/dev/null && ./default-check "$@")
+if [[ "$TEST_RUNTIME" == "jvm" || "x$VERIFY_SOFT_FAIL" == "xtrue" ]]; then
+  patch -p0 expected-stdout.txt < jvm-expected.patch
+fi
diff --git a/test/1955-pop-frame-jit-called/check b/test/1955-pop-frame-jit-called/check
index e25838a..d2d1843 100755
--- a/test/1955-pop-frame-jit-called/check
+++ b/test/1955-pop-frame-jit-called/check
@@ -23,5 +23,6 @@
 # The RI has restrictions and bugs around some PopFrame behavior that ART lacks.
 # See b/116003018. Some configurations cannot handle the class load events in
 # quite the right way so they are disabled there too.
-./default-check "$@" || \
-  (patch -p0 expected-stdout.txt < jvm-expected.patch >/dev/null && ./default-check "$@")
+if [[ "$TEST_RUNTIME" == "jvm" || "x$VERIFY_SOFT_FAIL" == "xtrue" ]]; then
+  patch -p0 expected-stdout.txt < jvm-expected.patch
+fi
diff --git a/test/1956-pop-frame-jit-calling/check b/test/1956-pop-frame-jit-calling/check
index e25838a..d2d1843 100755
--- a/test/1956-pop-frame-jit-calling/check
+++ b/test/1956-pop-frame-jit-calling/check
@@ -23,5 +23,6 @@
 # The RI has restrictions and bugs around some PopFrame behavior that ART lacks.
 # See b/116003018. Some configurations cannot handle the class load events in
 # quite the right way so they are disabled there too.
-./default-check "$@" || \
-  (patch -p0 expected-stdout.txt < jvm-expected.patch >/dev/null && ./default-check "$@")
+if [[ "$TEST_RUNTIME" == "jvm" || "x$VERIFY_SOFT_FAIL" == "xtrue" ]]; then
+  patch -p0 expected-stdout.txt < jvm-expected.patch
+fi
diff --git a/test/1963-add-to-dex-classloader-in-memory/check b/test/1963-add-to-dex-classloader-in-memory/check
index d536891..df785df 100755
--- a/test/1963-add-to-dex-classloader-in-memory/check
+++ b/test/1963-add-to-dex-classloader-in-memory/check
@@ -23,10 +23,6 @@
 # Some of our test devices are so old that they don't have memfd_create and are setup in such a way
 # that tmpfile() doesn't work. In these cases this test cannot complete successfully.
 
-if grep -q  -- '---NO memfd_create---' $@; then
-  echo "The test device doesn't have memfd_create. Cannot verify test!" >&2
-  exit 0
-fi
-
-
-./default-check "$@"
+# If we see this in stdout, make the expected stdout identical.
+grep -q -- '---NO memfd_create---' "$2" && echo '---NO memfd_create---' > "$1"
+exit 0
diff --git a/test/1969-force-early-return-void/check b/test/1969-force-early-return-void/check
index 24bbf07..2e0de80 100755
--- a/test/1969-force-early-return-void/check
+++ b/test/1969-force-early-return-void/check
@@ -23,5 +23,6 @@
 # The RI has restrictions and bugs around some PopFrame behavior that ART lacks.
 # See b/116003018. Some configurations cannot handle the class load events in
 # quite the right way so they are disabled there too.
-./default-check "$@" || \
-  (patch -p0 expected-stdout.txt < class-loading-expected.patch >/dev/null && ./default-check "$@")
+if [[ "$VERIFY_SOFT_FAIL" != "true" ]]; then
+  patch -p0 expected-stdout.txt < class-loading-expected.patch
+fi
diff --git a/test/2033-shutdown-mechanics/check b/test/2033-shutdown-mechanics/check
index 9523159..08c3ffc 100755
--- a/test/2033-shutdown-mechanics/check
+++ b/test/2033-shutdown-mechanics/check
@@ -22,5 +22,4 @@
 
 # The daemon thread seems to occasionally get stopped before finishing.
 # Check that the actual output is a line-by-line prefix of expected.
-head -n $(wc -l < $2) $1 | diff --strip-trailing-cr -q - "$2" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4" >/dev/null
+head -n $(wc -l < $2) $1 > $1.tmp && mv $1.tmp $1
diff --git a/test/2232-write-metrics-to-log/Android.bp b/test/2232-write-metrics-to-log/Android.bp
index a64567e..6a1e68c 100644
--- a/test/2232-write-metrics-to-log/Android.bp
+++ b/test/2232-write-metrics-to-log/Android.bp
@@ -15,7 +15,7 @@
 java_test {
     name: "art-run-test-2232-write-metrics-to-log",
     defaults: ["art-run-test-defaults"],
-    test_config_template: ":art-run-test-target-template",
+    test_config_template: ":art-run-test-target-no-test-suite-tag-template",
     srcs: ["src/**/*.java"],
     data: [
         ":art-run-test-2232-write-metrics-to-log-expected-stdout",
diff --git a/test/2232-write-metrics-to-log/check b/test/2232-write-metrics-to-log/check
index d12e8b1..31317ee 100755
--- a/test/2232-write-metrics-to-log/check
+++ b/test/2232-write-metrics-to-log/check
@@ -21,14 +21,4 @@
 # $4: Test's actual standard error
 
 # Check that one of the metrics appears in stderr.
-grep 'ClassVerificationTotalTime' "$4" >/dev/null
-MSG_FOUND=$?
-
-if [[ $MSG_FOUND -ne 0 ]] ; then
-  # Print out the log and return with error.
-  cat "$4"
-  exit 1
-fi
-
-# Success.
-exit 0
+sed -i -n 's/.*\(ClassVerificationTotalTime\).*/\1/p' "$4"
diff --git a/test/2232-write-metrics-to-log/expected-stderr.txt b/test/2232-write-metrics-to-log/expected-stderr.txt
index e69de29..9546999 100644
--- a/test/2232-write-metrics-to-log/expected-stderr.txt
+++ b/test/2232-write-metrics-to-log/expected-stderr.txt
@@ -0,0 +1 @@
+ClassVerificationTotalTime
diff --git a/test/2239-varhandle-perf/check b/test/2239-varhandle-perf/check
old mode 100644
new mode 100755
index 8ea102d..9593c52
--- a/test/2239-varhandle-perf/check
+++ b/test/2239-varhandle-perf/check
@@ -16,6 +16,7 @@
 
 # Dump the output of the benchmarks that run and report success. The
 # benchmarks ran successfully if we get as far as this script.
-
 cat "$2"
-exit 0
+
+# Delete all output to make the diff unconditionally pass.
+> "$2"
diff --git a/test/656-annotation-lookup-generic-jni/check b/test/656-annotation-lookup-generic-jni/check
index e02c84d..3c7753d 100755
--- a/test/656-annotation-lookup-generic-jni/check
+++ b/test/656-annotation-lookup-generic-jni/check
@@ -22,6 +22,4 @@
 
 # On gcstress configurations, an extra "JNI_OnUnload called" line may
 # be emitted. If so, remove it.
-sed -e '${/^JNI_OnUnload called$/d;}' "$2" > "$2.tmp"
-
-./default-check "$1" "$2.tmp" "$3" "$4"
+sed -i '/^JNI_OnUnload called$/d' "$2"
diff --git a/test/674-hiddenapi/check b/test/674-hiddenapi/check
old mode 100644
new mode 100755
index c8afc22..353882c
--- a/test/674-hiddenapi/check
+++ b/test/674-hiddenapi/check
@@ -20,11 +20,5 @@
 # $3: Test's expected standard error
 # $4: Test's actual standard error
 
-# Remove pid and date from the log messages.
-grep -v JNI_OnLoad "$2" \
-    | grep -v JNI_OnUnload \
-    > "$2.tmp"
-grep -vE '^dalvikvm(32|64) E [^]]+]' "$4" \
-    > "$4.tmp"
-
-./default-check "$1" "$2.tmp" "$3" "$4.tmp"
+sed -i -E '/(JNI_OnLoad|JNI_OnUnload)/d' "$2"
+sed -i -E '/^dalvikvm(32|64) E [^]]+]/d' "$4"
diff --git a/test/677-fsi/check b/test/677-fsi/check
old mode 100644
new mode 100755
index 8c7f18b..46bddf5
--- a/test/677-fsi/check
+++ b/test/677-fsi/check
@@ -21,11 +21,8 @@
 # $4: Test's actual standard error
 
 # Only keep the lines we're interested in.
-sed -s '/Hello World/!d' "$2" > "$2.tmp"
-sed -s '/^.*: oat file has dex code, but APK has uncompressed dex code/!d' "$4" > "$4.tmp"
+sed -i '/Hello World/!d' "$2"
+sed -i '/^.*: oat file has dex code, but APK has uncompressed dex code/!d' "$4"
 
 # Remove part of message containing filename.
-sed -s 's/^.*: //' "$4.tmp" > "$4.tmp2"
-
-diff --strip-trailing-cr -q "$1" "$2.tmp" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4.tmp2" >/dev/null
+sed -i 's/^.*: //' "$4"
diff --git a/test/688-shared-library/check b/test/688-shared-library/check
old mode 100644
new mode 100755
index 8501835..6d0f077
--- a/test/688-shared-library/check
+++ b/test/688-shared-library/check
@@ -23,7 +23,4 @@
 # Finalizers of DexFile will complain not being able to close
 # the main dex file, as it's still open. That's OK to ignore.
 # Oat file manager will also complain about duplicate dex files. Ignore.
-sed -e '/^E\/System/d' "$4" | sed -e '/.*oat_file_manager.*/d' > "$4.tmp"
-
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4.tmp" >/dev/null
+sed -i -e '/^E\/System/d' -e '/.*oat_file_manager.*/d' "$4"
diff --git a/test/707-checker-invalid-profile/check b/test/707-checker-invalid-profile/check
index 58d3a52..af64520 100755
--- a/test/707-checker-invalid-profile/check
+++ b/test/707-checker-invalid-profile/check
@@ -24,5 +24,4 @@
 # command strips out the error message.
 grep -v -f $1 $2 > $1
 grep -v -f $3 $4 > $3
-
-./default-check "$@"
+exit 0
diff --git a/test/817-hiddenapi/check b/test/817-hiddenapi/check
index 8c21ab4..3b6cc6a 100755
--- a/test/817-hiddenapi/check
+++ b/test/817-hiddenapi/check
@@ -22,6 +22,4 @@
 
 # On gcstress configurations, an extra "JNI_OnUnload called" line may
 # be emitted. If so, remove it.
-sed -e '${/^JNI_OnUnload called$/d;}' "$2" > "$2.tmp"
-
-./default-check "$1" "$2.tmp" "$3" "$4"
+sed -i '/^JNI_OnUnload called$/d' "$2"
diff --git a/test/954-invoke-polymorphic-verifier/check b/test/954-invoke-polymorphic-verifier/check
index 3f9e6dc..557b1b6 100755
--- a/test/954-invoke-polymorphic-verifier/check
+++ b/test/954-invoke-polymorphic-verifier/check
@@ -21,6 +21,4 @@
 # $4: Test's actual standard error
 
 # Strip out temporary file path information and indices from output.
-sed -e "s/ [(]declaration of.*//" -e "s/\[0x[0-9A-F]*\] //g" "$2" > "$2.tmp"
-diff --strip-trailing-cr -q "$1" "$2.tmp" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4" >/dev/null
+sed -i -e 's/ [(]declaration of.*//' -e 's/\[0x[0-9A-F]*\] //g' "$2"
diff --git a/test/980-redefine-object/check b/test/980-redefine-object/check
index 80a3cd7..4ea7c5e 100755
--- a/test/980-redefine-object/check
+++ b/test/980-redefine-object/check
@@ -23,8 +23,4 @@
 # The number of paused background threads (and therefore InterruptedExceptions)
 # can change so we will just delete their lines from the log.
 
-cat "$2" \
-    | sed "/Object allocated of type 'java\.lang\.InterruptedException'/d" \
-    | sed "/Object allocated of type 'java\.lang\.Long'/d" \
-    | diff --strip-trailing-cr -q "$1" - >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4" >/dev/null
+sed -i -E "/Object allocated of type 'java\.lang\.(InterruptedException|Long)'/d" "$2"
diff --git a/test/Android.bp b/test/Android.bp
index 4b466d4..813517b 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -1888,7 +1888,6 @@
     tool_files: [
         "art_build_rules.py",
         "run-test-build.py",
-        "etc/default-check",
         "etc/default-run",
         "etc/run-test-jar",
         ":art-run-test-bootclasspath",
diff --git a/test/etc/default-check b/test/etc/default-check
deleted file mode 100755
index f6f7bf4..0000000
--- a/test/etc/default-check
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2014 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.
-
-# Inputs:
-# $1: Test's expected standard output
-# $2: Test's actual standard output
-# $3: Test's expected standard error
-# $4: Test's actual standard error
-
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
-  && diff --strip-trailing-cr -q "$3" "$4" >/dev/null
diff --git a/test/run-test b/test/run-test
index cf859f0..f5820fa 100755
--- a/test/run-test
+++ b/test/run-test
@@ -329,6 +329,7 @@
       shift()
     elif arg == "--verify-soft-fail":
       run_args += ["--verify-soft-fail"]
+      os.environ["VERIFY_SOFT_FAIL"] = "true"
       shift()
     elif arg == "--no-optimize":
       run_args += ["--no-optimize"]
@@ -949,9 +950,13 @@
         good_run = "yes"
     else:
       good_run = "yes"
+    if os.path.exists(check_cmd):
+      run(f'./{check_cmd} "{expected_stdout}" "{test_stdout}" "{expected_stderr}" "{test_stderr}"')
     proc = run(
-        f'./{check_cmd} "{expected_stdout}" "{test_stdout}" "{expected_stderr}" "{test_stderr}"',
-        check=False)
+      f'diff --strip-trailing-cr -u "{expected_stdout}" "{test_stdout}" &&'
+      f'diff --strip-trailing-cr -u "{expected_stderr}" "{test_stderr}"',
+      check=False  # Don't crash on non-zero exit code.
+    )
     if proc.returncode == 0:
       if good_run == "yes":
         # test_stdout == expected_stdout && test_stderr == expected_stderr
diff --git a/test/run-test-build.py b/test/run-test-build.py
index 1436d3d..aa2cde1 100755
--- a/test/run-test-build.py
+++ b/test/run-test-build.py
@@ -50,7 +50,7 @@
   shutil.copytree(srcdir, dstdir)
 
   # Copy the default scripts if the test does not have a custom ones.
-  for name in ["run", "check"]:
+  for name in ["run"]:
     src, dst = f"art/test/etc/default-{name}", join(dstdir, name)
     if os.path.exists(dst):
       shutil.copy2(src, dstdir)  # Copy default script next to the custom script.
diff --git a/test/utils/regen-test-files b/test/utils/regen-test-files
index 40d57da..82aca3d 100755
--- a/test/utils/regen-test-files
+++ b/test/utils/regen-test-files
@@ -101,7 +101,6 @@
   "165-lock-owner-proxy",
   "168-vmstack-annotated",
   "176-app-image-string",
-  "2232-write-metrics-to-log",
   "304-method-tracing",
   "628-vdex",
   "643-checker-bogus-ic",