Move the Crash Reporter fix to Google Test where it belongs.

This commit is contained in:
Victor Zverovich 2014-08-23 10:25:21 -07:00
parent 59a462c67d
commit 8cc0d21124
2 changed files with 8 additions and 6 deletions

View File

@ -6535,6 +6535,8 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
# if GTEST_OS_MAC # if GTEST_OS_MAC
# include <crt_externs.h> # include <crt_externs.h>
# include <csignal>
# include <cstdlib>
# endif // GTEST_OS_MAC # endif // GTEST_OS_MAC
# include <errno.h> # include <errno.h>
@ -7337,6 +7339,11 @@ DeathTest::TestRole NoExecDeathTest::AssumeRole() {
GTEST_DEATH_TEST_CHECK_(child_pid != -1); GTEST_DEATH_TEST_CHECK_(child_pid != -1);
set_child_pid(child_pid); set_child_pid(child_pid);
if (child_pid == 0) { if (child_pid == 0) {
#if GTEST_OS_MAC
// This ensures that Crash Reporter is not invoked on death tests.
std::signal(SIGABRT, std::exit);
std::signal(SIGSEGV, std::exit);
#endif
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0])); GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));
set_write_fd(pipe_fd[1]); set_write_fd(pipe_fd[1]);
// Redirects all logging to stderr in the child process to prevent // Redirects all logging to stderr in the child process to prevent

View File

@ -26,8 +26,6 @@
*/ */
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <csignal>
#include <cstdlib>
#ifdef _WIN32 #ifdef _WIN32
# include <windows.h> # include <windows.h>
@ -35,10 +33,7 @@
#endif #endif
int main(int argc, char **argv) { int main(int argc, char **argv) {
#if defined(__APPLE__) #ifdef _WIN32
// This ensures that Crash Reporter is not invoked on death tests.
std::signal(SIGABRT, std::exit);
#elif defined(_WIN32)
// Don't display any error dialogs. This also suppresses message boxes // Don't display any error dialogs. This also suppresses message boxes
// on assertion failures in MinGW where _set_error_mode/CrtSetReportMode // on assertion failures in MinGW where _set_error_mode/CrtSetReportMode
// doesn't help. // doesn't help.