diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-04 12:28:40 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-04 12:28:40 +0000 |
commit | 7bb855498e47207ee741d2705e6c58aceec7470d (patch) | |
tree | 8beaf439140019a6a67d450c7faa21a8775c62b2 | |
parent | 7c4b66b04891b457cee5d6fe843ac1fbd50916a7 (diff) | |
download | chromium_src-7bb855498e47207ee741d2705e6c58aceec7470d.zip chromium_src-7bb855498e47207ee741d2705e6c58aceec7470d.tar.gz chromium_src-7bb855498e47207ee741d2705e6c58aceec7470d.tar.bz2 |
Emit test name in FATAL logs.
Today failing android tests make it difficult/impossible to correlate logcat
output with test failures. This CL adds the test name to the logcat output
between the 'F chromium: [FATAL' backtrace and the system-generated tombstone
(which previously appeared consecutively, with no mention of which test failed).
Contrived example (gotten by throwing a LOG(FATAL) into webrtc_browsertest.cc:572):
12-19 11:12:46.126 20361 20361 F chromium: [FATAL:webrtc_browsertest.cc(572)] AMI: yo!
12-19 11:12:46.126 20361 20361 F chromium: #00 0x757b9475 /data/app-lib/org.chromium.content_browsertests_apk-1/libbase.cr.so+0x0006a475
[...]
12-19 11:12:46.126 20361 20361 F chromium: #40 0x4010634b /system/lib/libc.so+0x0000e34b
12-19 11:12:46.126 20361 20361 F chromium:
NEW--> 12-19 11:12:46.126 20361 20361 E chromium: [ERROR:test_suite.cc(231)] Currently running: WebrtcBrowserTest.EstablishAudioVideoCallAndMeasureOutputLevel
12-19 11:12:46.126 20361 20361 F libc : Fatal signal 6 (SIGABRT) at 0x00004f89 (code=-6), thread 20361 (rowsertests_apk)
12-19 11:12:46.236 30166 30166 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-19 11:12:46.236 30166 30166 I DEBUG : Build fingerprint: 'google/hammerhead/hammerhead:4.4.2/KK/eng.fischman.20131206.175945:userdebug/dev-keys'
12-19 11:12:46.236 30166 30166 I DEBUG : Revision: '11'
[...]
Review URL: https://codereview.chromium.org/119383002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243028 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/test/test_suite.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc index 6579525..5154c05 100644 --- a/base/test/test_suite.cc +++ b/base/test/test_suite.cc @@ -226,6 +226,19 @@ int TestSuite::Run() { // static void TestSuite::UnitTestAssertHandler(const std::string& str) { +#if defined(OS_ANDROID) + // Correlating test stdio with logcat can be difficult, so we emit this + // helpful little hint about what was running. Only do this for Android + // because other platforms don't separate out the relevant logs in the same + // way. + const ::testing::TestInfo* const test_info = + ::testing::UnitTest::GetInstance()->current_test_info(); + if (test_info) { + LOG(ERROR) << "Currently running: " << test_info->test_case_name() << "." + << test_info->name(); + fflush(stderr); + } +#endif // defined(OS_ANDROID) RAW_LOG(FATAL, str.c_str()); } |