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

Unified Diff: util/test/mac/mach_multiprocess.cc

Issue 586053002: MachMultiprocess test: the child process must wait for the parent to finish (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Handle it in the base class Created 6 years, 3 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 | « util/mach/mach_message_server_test.cc ('k') | util/test/multiprocess.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/test/mac/mach_multiprocess.cc
diff --git a/util/test/mac/mach_multiprocess.cc b/util/test/mac/mach_multiprocess.cc
index 10fe15de3c7e625a9600d6546e6288abdc570167..f8603afa43e47332a7c497b9efa6de8020e3cd30 100644
--- a/util/test/mac/mach_multiprocess.cc
+++ b/util/test/mac/mach_multiprocess.cc
@@ -26,6 +26,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/rand_util.h"
#include "gtest/gtest.h"
+#include "util/file/fd_io.h"
#include "util/mach/mach_extensions.h"
#include "util/misc/scoped_forbid_return.h"
#include "util/test/errors.h"
@@ -261,6 +262,15 @@ void MachMultiprocess::MultiprocessChild() {
info_->remote_port.reset();
info_->local_port.reset();
+ // Close the write pipe now, for cases where the parent is waiting on it to
+ // be closed as an indication that the child has finished.
+ CloseWritePipe();
+
+ // Wait for the parent process to close its end of the pipe. The child process
+ // needs to remain alive until then because the parent process will attempt to
+ // verify it using the task port it has access to via ChildTask().
+ CheckedReadFDAtEOF(ReadPipeFD());
+
if (Test::HasFailure()) {
// Trigger the ScopedForbidReturn destructor.
return;
« no previous file with comments | « util/mach/mach_message_server_test.cc ('k') | util/test/multiprocess.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698