Add ability to override gtest LOG_TAGS
By default art gtests will run with ANDROID_LOG_TAGS=*:e regardless of
what that environment variable is actually set to. This is generally
sensible given the generally short nature of gtests. In some
circumstances it is useful to re-enable this logging when one is, for
example, debugging specific tests. This change adds a
ART_GTEST_OVERRIDE_LOG_TAGS which will be used as the value of
ANDROID_LOG_TAGS when set.
Test: export ART_GTEST_OVERRIDE_LOG_TAGS='*:v'; $ANDROID_HOST_OUT/nativetest64/art_runtime_tests/art_runtime_tests --gtest_filter="HeapTest*"
Test: $ANDROID_HOST_OUT/nativetest64/art_runtime_tests/art_runtime_tests --gtest_filter="HeapTest*"
Change-Id: I48a42a12284d41423e9936d5d27430d88f4dac0b
diff --git a/test/common/gtest_main.cc b/test/common/gtest_main.cc
index e1cbdc4..95dadcf 100644
--- a/test/common/gtest_main.cc
+++ b/test/common/gtest_main.cc
@@ -41,7 +41,8 @@
// 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);
+ const char* log_tag_override = getenv("ART_GTEST_OVERRIDE_LOG_TAGS");
+ setenv("ANDROID_LOG_TAGS", log_tag_override == nullptr ? "*:e" : log_tag_override, 1);
art::Locks::Init();
art::InitLogging(argv, art::Runtime::Abort);