Merge pull request #1619 from Steelskin/fuchsia-launchpad-removal

Remove launchpad dependency from Fuchsia.
This commit is contained in:
Gennadiy Civil 2018-06-05 04:03:38 +02:00 committed by GitHub
commit 98a0d007d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,7 +64,8 @@
# if GTEST_OS_FUCHSIA # if GTEST_OS_FUCHSIA
# include <fdio/io.h> # include <fdio/io.h>
# include <launchpad/launchpad.h> # include <fdio/spawn.h>
# include <zircon/processargs.h>
# include <zircon/syscalls.h> # include <zircon/syscalls.h>
# endif // GTEST_OS_FUCHSIA # endif // GTEST_OS_FUCHSIA
@ -926,29 +927,27 @@ DeathTest::TestRole FuchsiaDeathTest::AssumeRole() {
args.AddArgument(filter_flag.c_str()); args.AddArgument(filter_flag.c_str());
args.AddArgument(internal_flag.c_str()); args.AddArgument(internal_flag.c_str());
// Build the child process launcher.
zx_status_t status;
launchpad_t* lp;
status = launchpad_create(ZX_HANDLE_INVALID, args.Argv()[0], &lp);
GTEST_DEATH_TEST_CHECK_(status == ZX_OK);
// Build the pipe for communication with the child. // Build the pipe for communication with the child.
int read_fd; zx_status_t status;
status = launchpad_add_pipe(lp, &read_fd, kFuchsiaReadPipeFd); zx_handle_t child_pipe_handle;
GTEST_DEATH_TEST_CHECK_(status == ZX_OK); uint32_t type;
set_read_fd(read_fd); status = fdio_pipe_half(&child_pipe_handle, &type);
GTEST_DEATH_TEST_CHECK_(status >= 0);
set_read_fd(status);
// Set the command line arguments. // Set the pipe handle for the child.
status = launchpad_load_from_file(lp, args.Argv()[0]); fdio_spawn_action_t add_handle_action = {
GTEST_DEATH_TEST_CHECK_(status == ZX_OK); .action = FDIO_SPAWN_ACTION_ADD_HANDLE,
status = launchpad_set_args(lp, args.size(), args.Argv()); .h = {
GTEST_DEATH_TEST_CHECK_(status == ZX_OK); .id = PA_HND(type, kFuchsiaReadPipeFd),
.handle = child_pipe_handle
}
};
// Clone all the things (environment, stdio, namespace, ...). // Spawn the child process.
launchpad_clone(lp, LP_CLONE_ALL); status = fdio_spawn_etc(ZX_HANDLE_INVALID, FDIO_SPAWN_CLONE_ALL,
args.Argv()[0], args.Argv(), nullptr, 1,
// Launch the child process. &add_handle_action, &child_process_, nullptr);
status = launchpad_go(lp, &child_process_, nullptr);
GTEST_DEATH_TEST_CHECK_(status == ZX_OK); GTEST_DEATH_TEST_CHECK_(status == ZX_OK);
set_spawned(true); set_spawned(true);