Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
0a6edf3c
Commit
0a6edf3c
authored
May 30, 2018
by
Fabrice de Gans-Riberi
Browse files
Remvoe launchpad dependency from Fuchsia.
parent
4e4df226
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
23 deletions
+26
-23
googletest/src/gtest-death-test.cc
googletest/src/gtest-death-test.cc
+26
-23
No files found.
googletest/src/gtest-death-test.cc
View file @
0a6edf3c
...
@@ -64,7 +64,8 @@
...
@@ -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,31 @@ DeathTest::TestRole FuchsiaDeathTest::AssumeRole() {
...
@@ -926,29 +927,31 @@ 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 the command line arguments.
set_read_fd
(
status
);
status
=
launchpad_load_from_file
(
lp
,
args
.
Argv
()[
0
]);
GTEST_DEATH_TEST_CHECK_
(
status
==
ZX_OK
);
// Set the pipe handle for the child.
status
=
launchpad_set_args
(
lp
,
args
.
size
(),
args
.
Argv
());
fdio_spawn_action_t
add_handle_action
=
{
GTEST_DEATH_TEST_CHECK_
(
status
==
ZX_OK
);
.
action
=
FDIO_SPAWN_ACTION_ADD_HANDLE
,
.
h
=
{
// Clone all the things (environment, stdio, namespace, ...).
.
id
=
PA_HND
(
type
,
kFuchsiaReadPipeFd
),
launchpad_clone
(
lp
,
LP_CLONE_ALL
);
.
handle
=
child_pipe_handle
}
// Launch the child process.
};
status
=
launchpad_go
(
lp
,
&
child_process_
,
nullptr
);
// Spawn the child process.
char
err_msg
[
255
];
status
=
fdio_spawn_etc
(
ZX_HANDLE_INVALID
,
FDIO_SPAWN_CLONE_ALL
,
args
.
Argv
()[
0
],
args
.
Argv
(),
nullptr
,
1
,
&
add_handle_action
,
&
child_process_
,
err_msg
);
if
(
status
!=
ZX_OK
)
{
GTEST_LOG_
(
ERROR
)
<<
err_msg
;
}
GTEST_DEATH_TEST_CHECK_
(
status
==
ZX_OK
);
GTEST_DEATH_TEST_CHECK_
(
status
==
ZX_OK
);
set_spawned
(
true
);
set_spawned
(
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment