From 6076b6959ac6dd2f5f6c93d119b37899f70a30a8 Mon Sep 17 00:00:00 2001 From: Alex Light Date: Wed, 23 Sep 2020 14:25:18 -0700 Subject: 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 --- test/common/gtest_main.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/common/gtest_main.cc') 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); -- cgit v1.2.3-59-g8ed1b