win: Wrap test::ChildLauncher::Start() in ASSERT_NO_FATAL_FAILURE()

Test: crashpad_snapshot_test, crashpad_util_test, end_to_end_test
Change-Id: I09581521678fe3b083c409f308eeab2e583b3c9f
Reviewed-on: https://chromium-review.googlesource.com/481245
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
Mark Mentovai 2017-04-19 13:38:26 -04:00
parent e04194afd9
commit 74fddc3fed
8 changed files with 15 additions and 6 deletions

View File

@ -147,6 +147,7 @@
'dependencies': [ 'dependencies': [
'../client/client.gyp:crashpad_client', '../client/client.gyp:crashpad_client',
'../test/test.gyp:crashpad_test', '../test/test.gyp:crashpad_test',
'../third_party/gtest/gtest.gyp:gtest',
'../third_party/mini_chromium/mini_chromium.gyp:base', '../third_party/mini_chromium/mini_chromium.gyp:base',
'../util/util.gyp:crashpad_util', '../util/util.gyp:crashpad_util',
], ],

View File

@ -20,6 +20,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "client/crashpad_client.h" #include "client/crashpad_client.h"
#include "gtest/gtest.h"
#include "test/test_paths.h" #include "test/test_paths.h"
#include "test/win/child_launcher.h" #include "test/win/child_launcher.h"
#include "util/file/file_io.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(); test_executable.DirName().Append(L"hanging_program.exe").value();
ChildLauncher child(child_test_executable, argv[1]); ChildLauncher child(child_test_executable, argv[1]);
child.Start(); child.Start();
if (testing::Test::HasFatalFailure()) {
LOG(ERROR) << "failed to start child";
return EXIT_FAILURE;
}
// Wait until it's ready. // Wait until it's ready.
char c; char c;

View File

@ -148,7 +148,7 @@ void TestCrashingChild(const base::string16& directory_modification) {
L"_crashing_child.exe") L"_crashing_child.exe")
.value(); .value();
ChildLauncher child(child_test_executable, pipe_name); ChildLauncher child(child_test_executable, pipe_name);
child.Start(); ASSERT_NO_FATAL_FAILURE(child.Start());
// The child tells us (approximately) where it will crash. // The child tells us (approximately) where it will crash.
WinVMAddress break_near_address; WinVMAddress break_near_address;
@ -256,7 +256,7 @@ void TestDumpWithoutCrashingChild(
L"_dump_without_crashing.exe") L"_dump_without_crashing.exe")
.value(); .value();
ChildLauncher child(child_test_executable, pipe_name); 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. // The child tells us (approximately) where it will capture a dump.
WinVMAddress dump_near_address; WinVMAddress dump_near_address;

View File

@ -53,7 +53,7 @@ void TestExtraMemoryRanges(TestType type,
L"_extra_memory_ranges.exe") L"_extra_memory_ranges.exe")
.value(); .value();
ChildLauncher child(child_test_executable, L""); 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 // Wait for the child process to indicate that it's done setting up its
// annotations via the CrashpadInfo interface. // annotations via the CrashpadInfo interface.

View File

@ -57,7 +57,7 @@ void TestAnnotationsOnCrash(TestType type,
L"_simple_annotations.exe") L"_simple_annotations.exe")
.value(); .value();
ChildLauncher child(child_test_executable, L""); 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 // Wait for the child process to indicate that it's done setting up its
// annotations via the CrashpadInfo interface. // annotations via the CrashpadInfo interface.

View File

@ -46,7 +46,7 @@ void TestImageReaderChild(const base::string16& directory_modification) {
L"_image_reader.exe") L"_image_reader.exe")
.value(); .value();
ChildLauncher child(child_test_executable, done_uuid.ToString16()); ChildLauncher child(child_test_executable, done_uuid.ToString16());
child.Start(); ASSERT_NO_FATAL_FAILURE(child.Start());
char c; char c;
ASSERT_TRUE( ASSERT_TRUE(

View File

@ -39,6 +39,9 @@ class ChildLauncher {
//! \brief Starts the child process, after which the handle functions below //! \brief Starts the child process, after which the handle functions below
//! will be valid. //! 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(); void Start();
//! \brief Waits for the child process to exit. //! \brief Waits for the child process to exit.

View File

@ -151,7 +151,7 @@ void TestOtherProcess(const base::string16& directory_modification) {
AppendCommandLineArgument(done_uuid.ToString16(), &args); AppendCommandLineArgument(done_uuid.ToString16(), &args);
ChildLauncher child(child_test_executable, 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. // The child sends us a code address we can look up in the memory map.
WinVMAddress code_address; WinVMAddress code_address;