diff --git a/handler/handler.gyp b/handler/handler.gyp index 50479828..1f8fd751 100644 --- a/handler/handler.gyp +++ b/handler/handler.gyp @@ -147,6 +147,7 @@ 'dependencies': [ '../client/client.gyp:crashpad_client', '../test/test.gyp:crashpad_test', + '../third_party/gtest/gtest.gyp:gtest', '../third_party/mini_chromium/mini_chromium.gyp:base', '../util/util.gyp:crashpad_util', ], diff --git a/handler/win/crash_other_program.cc b/handler/win/crash_other_program.cc index 389aee1f..93a3a07a 100644 --- a/handler/win/crash_other_program.cc +++ b/handler/win/crash_other_program.cc @@ -20,6 +20,7 @@ #include "base/logging.h" #include "base/strings/stringprintf.h" #include "client/crashpad_client.h" +#include "gtest/gtest.h" #include "test/test_paths.h" #include "test/win/child_launcher.h" #include "util/file/file_io.h" @@ -93,6 +94,10 @@ int CrashOtherProgram(int argc, wchar_t* argv[]) { test_executable.DirName().Append(L"hanging_program.exe").value(); ChildLauncher child(child_test_executable, argv[1]); child.Start(); + if (testing::Test::HasFatalFailure()) { + LOG(ERROR) << "failed to start child"; + return EXIT_FAILURE; + } // Wait until it's ready. char c; diff --git a/snapshot/win/exception_snapshot_win_test.cc b/snapshot/win/exception_snapshot_win_test.cc index e2776964..286e7a6f 100644 --- a/snapshot/win/exception_snapshot_win_test.cc +++ b/snapshot/win/exception_snapshot_win_test.cc @@ -148,7 +148,7 @@ void TestCrashingChild(const base::string16& directory_modification) { L"_crashing_child.exe") .value(); ChildLauncher child(child_test_executable, pipe_name); - child.Start(); + ASSERT_NO_FATAL_FAILURE(child.Start()); // The child tells us (approximately) where it will crash. WinVMAddress break_near_address; @@ -256,7 +256,7 @@ void TestDumpWithoutCrashingChild( L"_dump_without_crashing.exe") .value(); ChildLauncher child(child_test_executable, pipe_name); - child.Start(); + ASSERT_NO_FATAL_FAILURE(child.Start()); // The child tells us (approximately) where it will capture a dump. WinVMAddress dump_near_address; diff --git a/snapshot/win/extra_memory_ranges_test.cc b/snapshot/win/extra_memory_ranges_test.cc index 49d835f0..a012027b 100644 --- a/snapshot/win/extra_memory_ranges_test.cc +++ b/snapshot/win/extra_memory_ranges_test.cc @@ -53,7 +53,7 @@ void TestExtraMemoryRanges(TestType type, L"_extra_memory_ranges.exe") .value(); ChildLauncher child(child_test_executable, L""); - child.Start(); + ASSERT_NO_FATAL_FAILURE(child.Start()); // Wait for the child process to indicate that it's done setting up its // annotations via the CrashpadInfo interface. diff --git a/snapshot/win/pe_image_annotations_reader_test.cc b/snapshot/win/pe_image_annotations_reader_test.cc index 02a61232..a20e986b 100644 --- a/snapshot/win/pe_image_annotations_reader_test.cc +++ b/snapshot/win/pe_image_annotations_reader_test.cc @@ -57,7 +57,7 @@ void TestAnnotationsOnCrash(TestType type, L"_simple_annotations.exe") .value(); ChildLauncher child(child_test_executable, L""); - child.Start(); + ASSERT_NO_FATAL_FAILURE(child.Start()); // Wait for the child process to indicate that it's done setting up its // annotations via the CrashpadInfo interface. diff --git a/snapshot/win/process_snapshot_win_test.cc b/snapshot/win/process_snapshot_win_test.cc index 75e6e708..a0e5cef4 100644 --- a/snapshot/win/process_snapshot_win_test.cc +++ b/snapshot/win/process_snapshot_win_test.cc @@ -46,7 +46,7 @@ void TestImageReaderChild(const base::string16& directory_modification) { L"_image_reader.exe") .value(); ChildLauncher child(child_test_executable, done_uuid.ToString16()); - child.Start(); + ASSERT_NO_FATAL_FAILURE(child.Start()); char c; ASSERT_TRUE( diff --git a/test/win/child_launcher.h b/test/win/child_launcher.h index 22463fa5..6674efe2 100644 --- a/test/win/child_launcher.h +++ b/test/win/child_launcher.h @@ -39,6 +39,9 @@ class ChildLauncher { //! \brief Starts the child process, after which the handle functions below //! will be valid. + //! + //! Errors are signaled via gtest assertions. This method may be invoked via + //! `ASSERT_NO_FATAL_FAILURE()` to assert that it succeeds. void Start(); //! \brief Waits for the child process to exit. diff --git a/util/win/process_info_test.cc b/util/win/process_info_test.cc index 54459424..322a987f 100644 --- a/util/win/process_info_test.cc +++ b/util/win/process_info_test.cc @@ -151,7 +151,7 @@ void TestOtherProcess(const base::string16& directory_modification) { AppendCommandLineArgument(done_uuid.ToString16(), &args); ChildLauncher child(child_test_executable, args); - child.Start(); + ASSERT_NO_FATAL_FAILURE(child.Start()); // The child sends us a code address we can look up in the memory map. WinVMAddress code_address;