diff options
author | Abseil Team <absl-team@google.com> | 2019-04-04 17:36:23 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2019-04-05 15:46:06 (GMT) |
commit | c061ffafd85102e56bb6bfc9a9a05767abedc177 (patch) | |
tree | 8a00de756565d7b91e1eae3563a85bed96e794ed | |
parent | 1f3b098ef3afb1d186778d47ccecf9d188ef49b2 (diff) | |
download | googletest-c061ffafd85102e56bb6bfc9a9a05767abedc177.zip googletest-c061ffafd85102e56bb6bfc9a9a05767abedc177.tar.gz googletest-c061ffafd85102e56bb6bfc9a9a05767abedc177.tar.bz2 |
Googletest export
[fdio] Improve fdio_pipe_half signature, step 3.
The return value on fdio_pipe_half conflated two things: the error code
on failure (as a zx_status_t) or a file descriptor on success. This
technically worked, because they're both ints, the error code was always
negative, and the file descriptor always positive. However, the stated
return type of zx_status_t was misleading. This changes the signature
such that it always returns an actual zx_status_t, and the file
descriptor is returned through a pointer argument.
Also remove the last argument, since it was always given the same value.
This needs to be done as a soft transition because it's called from the
Dart runtime, from googletest, and from Crashpad, and Crashpad and
Chromium both depend on googletest on Fuchsia. The steps are as follows:
1) Add fdio_pipe_half2.
2) Update Dart to use fdio_pipe_half2.
3) Update googletest to use fdio_pipe_half2.
4) Roll updated googletest into Chronium.
5) Update Crashpad to use fdio_pipe_half2 and roll updated googletest into it.
6) Update fdio_pipe_half to match fdio_pipe_half2.
7) Update Dart to use fdio_pipe_half again.
8) Update googletest to use fdio_pipe_half again.
9) Roll updated googletest into Chronium.
10) Update Crashpad to use fdio_pipe_half again and roll updated googletest into it.
11) Remove fdio_pipe_half2.
This is step 3.
PiperOrigin-RevId: 241957137
-rw-r--r-- | googletest/src/gtest-death-test.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index cd0ca05..a78ab21 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -988,16 +988,16 @@ DeathTest::TestRole FuchsiaDeathTest::AssumeRole() { // Build the pipe for communication with the child. zx_status_t status; zx_handle_t child_pipe_handle; - uint32_t type; - status = fdio_pipe_half(&child_pipe_handle, &type); - GTEST_DEATH_TEST_CHECK_(status >= 0); - set_read_fd(status); + int child_pipe_fd; + status = fdio_pipe_half2(&child_pipe_fd, &child_pipe_handle); + GTEST_DEATH_TEST_CHECK_(status != ZX_OK); + set_read_fd(child_pipe_fd); // Set the pipe handle for the child. fdio_spawn_action_t spawn_actions[2] = {}; fdio_spawn_action_t* add_handle_action = &spawn_actions[0]; add_handle_action->action = FDIO_SPAWN_ACTION_ADD_HANDLE; - add_handle_action->h.id = PA_HND(type, kFuchsiaReadPipeFd); + add_handle_action->h.id = PA_HND(PA_FD, kFuchsiaReadPipeFd); add_handle_action->h.handle = child_pipe_handle; // Create a socket pair will be used to receive the child process' stderr. |