From 087d04dadc8f8aba2e798af4fea4b33ced9213f7 Mon Sep 17 00:00:00 2001 From: "ojan@chromium.org" Date: Fri, 17 Apr 2009 22:34:15 +0000 Subject: Fix error suppressing. It turns out that both the signal handling and the exception port bits are needed to avoid the crash reporter. There are still cases we miss. I was able to hit a TestShell that popped up the crash reporter running the tests, but I was only able to hit it once. Review URL: http://codereview.chromium.org/67270 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13972 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/tools/test_shell/test_shell_platform_delegate_mac.mm | 11 ++++++++++- webkit/tools/test_shell/test_shell_switches.cc | 4 ++++ webkit/tools/test_shell/test_shell_switches.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'webkit') diff --git a/webkit/tools/test_shell/test_shell_platform_delegate_mac.mm b/webkit/tools/test_shell/test_shell_platform_delegate_mac.mm index a88bf83..fdb276d 100644 --- a/webkit/tools/test_shell/test_shell_platform_delegate_mac.mm +++ b/webkit/tools/test_shell/test_shell_platform_delegate_mac.mm @@ -266,8 +266,17 @@ void TestShellPlatformDelegate::SelectUnifiedTheme() { } void TestShellPlatformDelegate::SuppressErrorReporting() { + const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); + // If we die during tests, we don't want to be spamming the user's crash - // reporter. + // reporter. Set our exception port to null and add signal handlers. + // Both of these are necessary to avoid the crash reporter. Although, we do + // still seem to be missing some cases. + if (!parsed_command_line.HasSwitch(test_shell::kGDB)) { + task_set_exception_ports(mach_task_self(), EXC_MASK_ALL, MACH_PORT_NULL, + EXCEPTION_DEFAULT, THREAD_STATE_NONE); + } + // The less scary signals... signal(SIGINT, SimpleSignalHandler); signal(SIGHUP, SimpleSignalHandler); diff --git a/webkit/tools/test_shell/test_shell_switches.cc b/webkit/tools/test_shell/test_shell_switches.cc index 9bda588..ed8dd07 100644 --- a/webkit/tools/test_shell/test_shell_switches.cc +++ b/webkit/tools/test_shell/test_shell_switches.cc @@ -64,6 +64,10 @@ const wchar_t kAllowScriptsToCloseWindows[] = L"allow-scripts-to-close-windows"; extern const wchar_t kCheckLayoutTestSystemDeps[] = L"check-layout-test-sys-deps"; +// If set, we are running under GDB so allow a certain class of errors +// to happen even if in layout test mode. +extern const wchar_t kGDB[] = L"gdb"; + // Make functions of the Profiler class available in javascript extern const wchar_t kProfiler[] = L"profiler"; diff --git a/webkit/tools/test_shell/test_shell_switches.h b/webkit/tools/test_shell/test_shell_switches.h index 597615f..7743aa6 100644 --- a/webkit/tools/test_shell/test_shell_switches.h +++ b/webkit/tools/test_shell/test_shell_switches.h @@ -28,6 +28,7 @@ extern const wchar_t kEnableFileCookies[]; extern const wchar_t kEnableTracing[]; extern const wchar_t kAllowScriptsToCloseWindows[]; extern const wchar_t kCheckLayoutTestSystemDeps[]; +extern const wchar_t kGDB[]; extern const wchar_t kProfiler[]; } // namespace test_shell -- cgit v1.1