ART: Allow scoped adjustments to log verbosity
Add ScopedLogSeverity to adjust the logging level.
Suppress warnings by default in gtests. Suppress errors in instances
where errors are expected.
Change-Id: If3ef865813e9505ab60bc90baed63ff11d90afbb
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index e017699..d48ac9d 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -20,6 +20,7 @@
#include <dlfcn.h>
#include <fcntl.h>
#include <ScopedLocalRef.h>
+#include <stdlib.h>
#include "../../external/icu/icu4c/source/common/unicode/uvernum.h"
#include "base/macros.h"
@@ -43,6 +44,11 @@
#include "well_known_classes.h"
int main(int argc, char **argv) {
+ // Gtests can be very noisy. For example, an executable with multiple tests will trigger native
+ // bridge warnings. The following line reduces the minimum log severity to ERROR and suppresses
+ // everything else. In case you want to see all messages, comment out the line.
+ setenv("ANDROID_LOG_TAGS", "*:e", 1);
+
art::InitLogging(argv);
LOG(::art::INFO) << "Running main() from common_runtime_test.cc...";
testing::InitGoogleTest(&argc, argv);