forked from cory/tildefriends
libuv 1.44.0
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3856 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
38
deps/libuv/test/test-spawn.c
vendored
38
deps/libuv/test/test-spawn.c
vendored
@ -1891,6 +1891,44 @@ TEST_IMPL(spawn_quoted_path) {
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_IMPL(spawn_exercise_sigchld_issue) {
|
||||
int r;
|
||||
int i;
|
||||
uv_process_options_t dummy_options = {0};
|
||||
uv_process_t dummy_processes[100];
|
||||
char* args[2];
|
||||
|
||||
init_process_options("spawn_helper1", exit_cb);
|
||||
|
||||
r = uv_spawn(uv_default_loop(), &process, &options);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
// This test exercises a bug in the darwin kernel that causes SIGCHLD not to
|
||||
// be delivered sometimes. Calling posix_spawn many times increases the
|
||||
// likelihood of encountering this issue, so spin a few times to make this
|
||||
// test more reliable.
|
||||
dummy_options.file = args[0] = "program-that-had-better-not-exist";
|
||||
args[1] = NULL;
|
||||
dummy_options.args = args;
|
||||
dummy_options.exit_cb = fail_cb;
|
||||
dummy_options.flags = 0;
|
||||
for (i = 0; i < 100; i++) {
|
||||
r = uv_spawn(uv_default_loop(), &dummy_processes[i], &dummy_options);
|
||||
if (r != UV_ENOENT)
|
||||
ASSERT_EQ(r, UV_EACCES);
|
||||
uv_close((uv_handle_t*) &dummy_processes[i], close_cb);
|
||||
}
|
||||
|
||||
r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
ASSERT_EQ(r, 0);
|
||||
|
||||
ASSERT_EQ(exit_cb_called, 1);
|
||||
ASSERT_EQ(close_cb_called, 101);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Helper for child process of spawn_inherit_streams */
|
||||
#ifndef _WIN32
|
||||
void spawn_stdin_stdout(void) {
|
||||
|
Reference in New Issue
Block a user