Ejemplo n.º 1
0
TEST(SignalHandler, Simple) {
  addFatalSignalCallback(callback1);
  addFatalSignalCallback(callback2);
  installFatalSignalHandler();
  installFatalSignalCallbacks();

  EXPECT_DEATH(
      failHard(),
      "^\\*\\*\\* Aborted at [0-9]+ \\(Unix time, try 'date -d @[0-9]+'\\) "
      "\\*\\*\\*\n"
      "\\*\\*\\* Signal 11 \\(SIGSEGV\\) \\(0x2a\\) received by PID [0-9]+ "
      "\\(pthread TID 0x[0-9a-f]+\\) \\(linux TID [0-9]+\\) "
      "\\(maybe from PID [0-9]+, UID [0-9]+\\) "
      "\\(code: address not mapped to object\\), "
      "stack trace: \\*\\*\\*\n"
      ".*\n"
      ".*    @ [0-9a-f]+.* folly::symbolizer::test::SignalHandler_Simple_Test"
      "::TestBody\\(\\).*\n"
      ".*\n"
      ".*    @ [0-9a-f]+.* main.*\n"
      ".*\n"
      "Callback1\n"
      "Callback2\n"
      ".*");
}
Ejemplo n.º 2
0
TEST(SignalHandler, Simple) {
  addFatalSignalCallback(callback1);
  addFatalSignalCallback(callback2);
  installFatalSignalHandler();
  installFatalSignalCallbacks();

  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]+ "
      "\\(TID 0x[0-9a-f]+\\), stack trace: \\*\\*\\*\n"
      ".*\n"
      "    @ [0-9a-f]+ folly::symbolizer::test::SignalHandler_Simple_Test"
      "::TestBody\\(\\)\n"
      ".*\n"
      "    @ [0-9a-f]+ main\n"
      ".*\n"
      "Callback1\n"
      "Callback2\n"
#endif
      );
}
Ejemplo n.º 3
0
TEST(SignalHandler, Simple) {
  addFatalSignalCallback(callback1);
  addFatalSignalCallback(callback2);
  installFatalSignalHandler();
  installFatalSignalCallbacks();

  EXPECT_DEATH(
      failHard(),
      "^\\*\\*\\* Aborted at [0-9]+ \\(Unix time, try 'date -d @[0-9]+'\\) "
      "\\*\\*\\*\n"
      "\\*\\*\\* Signal 11 \\(SIGSEGV\\) \\(0x2a\\) received by PID [0-9]+ "
      "\\(TID 0x[0-9a-f]+\\), stack trace: \\*\\*\\*\n"
      ".*\n"
      "    @ [0-9a-f]+ folly::symbolizer::test::SignalHandler_Simple_Test"
      "::TestBody\\(\\)\n"
      ".*\n"
      "    @ [0-9a-f]+ main\n"
      ".*\n"
      "Callback1\n"
      "Callback2\n"
      );
}