From: Jim Meyering Date: Sat, 8 Feb 2014 00:21:17 +0000 (-0800) Subject: folly: avoid false-positive ASAN-abort from SignalHandlerTest X-Git-Tag: v0.22.0~696 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=13550f968e5a78677f0d29b30110df36889f7476;p=folly.git folly: avoid false-positive ASAN-abort from SignalHandlerTest Summary: Without this change, the sig-handling test's deliberate invalid access would trigger an ASAN-abort, which differed from the expected SEGV. Skip this test when ASAN is enabled. * folly/experimental/symbolizer/test/SignalHandlerTest.cpp: Include CPortability.h for definion of FOLLY_SANITIZE_ADDRESS. (SignalHandler) [FOLLY_SANITIZE_ADDRESS]: Provide a different regexp to match the first line of output from an ASAN-enabled binary. Test Plan: fbconfig --sanitize=address --platform-all=gcc-4.8.1-glibc-2.17 \ folly/experimental/symbolizer/test:signal_handler_test \ && fbmake --fast runtests \ && fbmake --fast runtests_opt Sample output, before this change: https://phabricator.fb.com/P5428975 (search down to first AddressSanitizer abort. With this change, expect that test to pass. Reviewed By: lucian@fb.com FB internal diff: D1164768 --- diff --git a/folly/experimental/symbolizer/test/SignalHandlerTest.cpp b/folly/experimental/symbolizer/test/SignalHandlerTest.cpp index e284f16e..cc1a19a7 100644 --- a/folly/experimental/symbolizer/test/SignalHandlerTest.cpp +++ b/folly/experimental/symbolizer/test/SignalHandlerTest.cpp @@ -21,6 +21,7 @@ #include "folly/FileUtil.h" #include "folly/Range.h" +#include "folly/CPortability.h" namespace folly { namespace symbolizer { namespace test { @@ -49,6 +50,11 @@ TEST(SignalHandler, Simple) { EXPECT_DEATH( failHard(), +#ifdef FOLLY_SANITIZE_ADDRESS + // Testing an ASAN-enabled binary evokes a different diagnostic. + // Use a regexp that requires only the first line of that output: + "^ASAN:SIGSEGV\n.*" +#else "^\\*\\*\\* Aborted at [0-9]+ \\(Unix time, try 'date -d @[0-9]+'\\) " "\\*\\*\\*\n" "\\*\\*\\* Signal 11 \\(SIGSEGV\\) \\(0x2a\\) received by PID [0-9]+ " @@ -61,6 +67,7 @@ TEST(SignalHandler, Simple) { ".*\n" "Callback1\n" "Callback2\n" +#endif ); }