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

Unified Diff: base/test/launcher/test_launcher.cc

Issue 2692273008: Hacky slashy (Closed)
Patch Set: rebase on config CL, and minor fixes Created 3 years, 7 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 | « base/task_scheduler/task_scheduler_impl.cc ('k') | base/test/launcher/unit_test_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/test_launcher.cc
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 4553002e320b65f3c36d73efe04a68180548bf59..c97363a4d2181ffb2fe22146febbf916925515a7 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -61,6 +61,11 @@
#include "base/win/windows_version.h"
#endif
+#if defined(OS_FUCHSIA)
+#include <magenta/process.h>
+#include <magenta/syscalls.h>
+#endif
+
namespace base {
// See https://groups.google.com/a/chromium.org/d/msg/chromium-dev/nkdTP7sstSc/uT3FaE_sgkAJ .
@@ -114,7 +119,7 @@ TestLauncherTracer* GetTestLauncherTracer() {
return tracer;
}
-#if defined(OS_POSIX)
+#if defined(OS_POSIX) && !defined(OS_FUCHSIA)
// Self-pipe that makes it possible to do complex shutdown handling
// outside of the signal handler.
int g_shutdown_pipe[2] = { -1, -1 };
@@ -296,6 +301,18 @@ int LaunchChildTestProcessWithOptions(
}
#endif // defined(OS_WIN)
+#if defined(OS_FUCHSIA)
+ DCHECK_EQ(new_options.job_handle, MX_HANDLE_INVALID);
+ if (flags & TestLauncher::USE_JOB_OBJECTS) {
+ mx_status_t status =
+ mx_job_create(mx_job_default(), 0, &new_options.job_handle);
+ if (status < 0) {
+ LOG(ERROR) << "Failed to create job object";
+ return -1;
+ }
+ }
+#endif
+
#if defined(OS_LINUX)
// To prevent accidental privilege sharing to an untrusted child, processes
// are started with PR_SET_NO_NEW_PRIVS. Do not set that here, since this
@@ -356,7 +373,7 @@ int LaunchChildTestProcessWithOptions(
// to do that twice and trigger all kinds of log messages.
AutoLock lock(*GetLiveProcessesLock());
-#if defined(OS_POSIX)
+#if defined(OS_POSIX) && !defined(OS_FUCHSIA)
if (exit_code != 0) {
// On POSIX, in case the test does not exit cleanly, either due to a crash
// or due to it timing out, we need to clean up any child processes that
@@ -524,7 +541,7 @@ bool TestLauncher::Run() {
// original value.
int requested_cycles = cycles_;
-#if defined(OS_POSIX)
+#if defined(OS_POSIX) && !defined(OS_FUCHSIA)
CHECK_EQ(0, pipe(g_shutdown_pipe));
struct sigaction action;
@@ -679,7 +696,7 @@ void TestLauncher::OnTestFinished(const TestResult& original_result) {
test_broken_count_);
fflush(stdout);
-#if defined(OS_POSIX)
+#if defined(OS_POSIX) && !defined(OS_FUCHSIA)
KillSpawnedTestProcesses();
#endif // defined(OS_POSIX)
« no previous file with comments | « base/task_scheduler/task_scheduler_impl.cc ('k') | base/test/launcher/unit_test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698