summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2020-09-23 14:25:18 -0700
committer Treehugger Robot <treehugger-gerrit@google.com> 2020-09-24 23:51:52 +0000
commit6076b6959ac6dd2f5f6c93d119b37899f70a30a8 (patch)
treefd54eb88344bdc047529c9d7c57765612d34f178
parenta48f6f1d64bf4606c6f100eb6dae674409d184cd (diff)
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
-rw-r--r--test/common/gtest_main.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/common/gtest_main.cc b/test/common/gtest_main.cc
index e1cbdc4104..95dadcf5f0 100644
--- a/test/common/gtest_main.cc
+++ b/test/common/gtest_main.cc
@@ -41,7 +41,8 @@ int main(int argc, char** argv, char** envp) {
// 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);