From: Chip Turner Date: Wed, 31 Dec 2014 03:03:54 +0000 (-0800) Subject: Improve unit test output and logging to diagnose build breaks X-Git-Tag: v0.22.0~56 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=45bf87b32f76d8f8c1296b3086bfa3dfa60991bd;p=folly.git Improve unit test output and logging to diagnose build breaks Summary: I can't repro the very frequent breakage we get from the unit test framework, and it would be helpful to get the proper error messages from it, so this adjusts the logging and changes a CHECK to an EXPECT to get more data when the failure occurs. Test Plan: runtests Reviewed By: hans@fb.com Subscribers: lins, anca, folly-diffs@ FB internal diff: D1761800 Tasks: 5870141 Signature: t1:1761800:1420226753:27a66fb0ce47cd57529e5fd0518550fb649c9eb5 --- diff --git a/folly/experimental/symbolizer/test/StackTraceTest.cpp b/folly/experimental/symbolizer/test/StackTraceTest.cpp index 29f8fb1e..6e2745d3 100644 --- a/folly/experimental/symbolizer/test/StackTraceTest.cpp +++ b/folly/experimental/symbolizer/test/StackTraceTest.cpp @@ -52,9 +52,9 @@ void verifyStackTraces() { // Other than the top 2 frames (this one and getStackTrace / // getStackTraceSafe), the stack traces should be identical for (size_t i = 2; i < fa.frameCount; ++i) { - VLOG(1) << "i=" << i << " " << std::hex << fa.addresses[i] << " " - << faSafe.addresses[i]; - CHECK_EQ(fa.addresses[i], faSafe.addresses[i]); + LOG(INFO) << "i=" << i << " " << std::hex << "0x" << fa.addresses[i] + << " 0x" << faSafe.addresses[i]; + EXPECT_EQ(fa.addresses[i], faSafe.addresses[i]); } } @@ -85,11 +85,12 @@ TEST(StackTraceTest, Signal) { sa.sa_flags = SA_RESETHAND | SA_SIGINFO; CHECK_ERR(sigaction(SIGUSR1, &sa, nullptr)); raise(SIGUSR1); - CHECK(handled); + EXPECT_TRUE(handled); } int main(int argc, char *argv[]) { testing::InitGoogleTest(&argc, argv); gflags::ParseCommandLineFlags(&argc, &argv, true); + google::InitGoogleLogging(argv[0]); return RUN_ALL_TESTS(); }