ART: Make run-tests more verbose

Make run-tests log ERROR level on host. Adjust some internal LOG(ERROR)
to LOG(WARNING). Add check scripts to adjust for other LOG(ERROR)
messages.

Bug: 18713034
Change-Id: I2a3e055baa6a0e31f106364c300c20963a59ed94
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 3592d2c..8609807 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3511,7 +3511,7 @@
           StringPrintf("Rejecting class %s that attempts to sub-class erroneous class %s",
                        PrettyDescriptor(klass.Get()).c_str(),
                        PrettyDescriptor(super.Get()).c_str()));
-      LOG(ERROR) << error_msg  << " in " << klass->GetDexCache()->GetLocation()->ToModifiedUtf8();
+      LOG(WARNING) << error_msg  << " in " << klass->GetDexCache()->GetLocation()->ToModifiedUtf8();
       Handle<mirror::Throwable> cause(hs.NewHandle(self->GetException(nullptr)));
       if (cause.Get() != nullptr) {
         self->ClearException();
@@ -3584,7 +3584,7 @@
       }
     }
   } else {
-    LOG(ERROR) << "Verification failed on class " << PrettyDescriptor(klass.Get())
+    LOG(WARNING) << "Verification failed on class " << PrettyDescriptor(klass.Get())
         << " in " << klass->GetDexCache()->GetLocation()->ToModifiedUtf8()
         << " because: " << error_msg;
     self->AssertNoPendingException();
diff --git a/runtime/native/java_lang_Runtime.cc b/runtime/native/java_lang_Runtime.cc
index dc0cb7b..97b17bf 100644
--- a/runtime/native/java_lang_Runtime.cc
+++ b/runtime/native/java_lang_Runtime.cc
@@ -65,7 +65,7 @@
       Fn android_update_LD_LIBRARY_PATH = reinterpret_cast<Fn>(sym);
       (*android_update_LD_LIBRARY_PATH)(ldLibraryPath.c_str());
     } else {
-      LOG(ERROR) << "android_update_LD_LIBRARY_PATH not found; .so dependencies will not work!";
+      LOG(WARNING) << "android_update_LD_LIBRARY_PATH not found; .so dependencies will not work!";
     }
   }
 
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 16edab3..cb6ed64 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1854,7 +1854,7 @@
 }
 
 void Thread::ThrowOutOfMemoryError(const char* msg) {
-  LOG(ERROR) << StringPrintf("Throwing OutOfMemoryError \"%s\"%s",
+  LOG(WARNING) << StringPrintf("Throwing OutOfMemoryError \"%s\"%s",
       msg, (tls32_.throwing_OutOfMemoryError ? " (recursive case)" : ""));
   ThrowLocation throw_location = GetCurrentLocationForThrow();
   if (!tls32_.throwing_OutOfMemoryError) {
@@ -1862,7 +1862,7 @@
     ThrowNewException(throw_location, "Ljava/lang/OutOfMemoryError;", msg);
     tls32_.throwing_OutOfMemoryError = false;
   } else {
-    Dump(LOG(ERROR));  // The pre-allocated OOME has no stack, so help out and log one.
+    Dump(LOG(WARNING));  // The pre-allocated OOME has no stack, so help out and log one.
     SetException(throw_location, Runtime::Current()->GetPreAllocatedOutOfMemoryError());
   }
 }
diff --git a/test/030-bad-finalizer/check b/test/030-bad-finalizer/check
new file mode 100755
index 0000000..e5d5c4e
--- /dev/null
+++ b/test/030-bad-finalizer/check
@@ -0,0 +1,20 @@
+#!/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.
+
+# Strip timeout logging. These are "E/System" messages.
+sed -e '/^E\/System/d' "$2" > "$2.tmp"
+
+diff --strip-trailing-cr -q "$1" "$2.tmp" >/dev/null
diff --git a/test/059-finalizer-throw/check b/test/059-finalizer-throw/check
new file mode 100755
index 0000000..8bc59c6
--- /dev/null
+++ b/test/059-finalizer-throw/check
@@ -0,0 +1,20 @@
+#!/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.
+
+# Strip uncaught exception logging. These are "E/System" messages.
+sed -e '/^E\/System/d' "$2" > "$2.tmp"
+
+diff --strip-trailing-cr -q "$1" "$2.tmp" >/dev/null
diff --git a/test/099-vmdebug/check b/test/099-vmdebug/check
new file mode 100755
index 0000000..7b47ac1
--- /dev/null
+++ b/test/099-vmdebug/check
@@ -0,0 +1,20 @@
+#!/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.
+
+# Strip the process pids and line numbers from exact error messages.
+sed -e 's/^art E.*\] //' "$2" > "$2.tmp"
+
+diff --strip-trailing-cr -q "$1" "$2.tmp" >/dev/null
diff --git a/test/099-vmdebug/expected.txt b/test/099-vmdebug/expected.txt
index 579f98f..392efe5 100644
--- a/test/099-vmdebug/expected.txt
+++ b/test/099-vmdebug/expected.txt
@@ -7,13 +7,17 @@
 status=0
 Test starting when already started
 status=1
+Trace already in progress, ignoring this request
 status=1
 Test stopping when already stopped
 status=0
+Trace stop requested, but no trace currently running
 status=0
 Test tracing with empty filename
+Unable to open trace file '': No such file or directory
 Got expected exception
 Test tracing with bogus (< 1024 && != 0) filesize
 Got expected exception
 Test sampling with bogus (<= 0) interval
+Invalid sampling interval: 0
 Got expected exception
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 04eea4e..0c49674 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -370,7 +370,7 @@
     if [ "$DEV_MODE" = "y" ]; then
         export ANDROID_LOG_TAGS='*:d'
     else
-        export ANDROID_LOG_TAGS='*:s'
+        export ANDROID_LOG_TAGS='*:e'
     fi
     export ANDROID_DATA="$DEX_LOCATION"
     export ANDROID_ROOT="${ANDROID_ROOT}"