Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: content/public/test/browser_test_base.cc

Issue 2250503002: Handle SIGSEGV in BrowserTestBase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_base.cc
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc
index c6d2e4b6a03c91f8fc0a4adc8ae160b69d20c030..0b510beb8b483eefcdec4d63d0ceac8e1fa3d53e 100644
--- a/content/public/test/browser_test_base.cc
+++ b/content/public/test/browser_test_base.cc
@@ -62,18 +62,19 @@ namespace content {
namespace {
#if defined(OS_POSIX)
-// On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make
-// debugging easier) and also exit with a known error code (so that the test
-// framework considers this a failure -- http://crbug.com/57578).
+// On SIGSEGV or SIGTERM (sent by the runner on timeouts), dump a stack trace
+// (to make debugging easier) and also exit with a known error code (so that
+// the test framework considers this a failure -- http://crbug.com/57578).
// Note: We only want to do this in the browser process, and not forked
// processes. That might lead to hangs because of locks inside tcmalloc or the
// OS. See http://crbug.com/141302.
static int g_browser_process_pid;
static void DumpStackTraceSignalHandler(int signal) {
if (g_browser_process_pid == base::GetCurrentProcId()) {
- logging::RawLog(logging::LOG_ERROR,
- "BrowserTestBase signal handler received SIGTERM. "
- "Backtrace:\n");
+ std::string message("BrowserTestBase received signal: ");
+ message += strsignal(signal);
+ message += ". Backtrace:\n";
+ logging::RawLog(logging::LOG_ERROR, message.c_str());
base::debug::StackTrace().Print();
}
_exit(128 + signal);
@@ -314,10 +315,11 @@ void BrowserTestBase::TearDown() {
void BrowserTestBase::ProxyRunTestOnMainThreadLoop() {
#if defined(OS_POSIX)
- if (handle_sigterm_) {
- g_browser_process_pid = base::GetCurrentProcId();
+ g_browser_process_pid = base::GetCurrentProcId();
+ signal(SIGSEGV, DumpStackTraceSignalHandler);
+
+ if (handle_sigterm_)
signal(SIGTERM, DumpStackTraceSignalHandler);
- }
#endif // defined(OS_POSIX)
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698