Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
test: stdin/out/err should be set to /dev/null when ignored
  • Loading branch information
indutny authored and piscisaureus committed Jun 2, 2012
1 parent bdb8b3a commit 1cd9642
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/run-tests.c
Expand Up @@ -120,5 +120,17 @@ static int maybe_run_test(int argc, char **argv) {
return 1;
}

if (strcmp(argv[1], "spawn_helper6") == 0) {
int r;

r = fprintf(stdout, "hello world\n");
ASSERT(r > 0);

r = fprintf(stderr, "hello errworld\n");
ASSERT(r > 0);

return 1;
}

return run_test(argv[1], TEST_TIMEOUT, 0);
}
2 changes: 2 additions & 0 deletions test/test-list.h
Expand Up @@ -120,6 +120,7 @@ TEST_DECLARE (spawn_exit_code)
TEST_DECLARE (spawn_stdout)
TEST_DECLARE (spawn_stdin)
TEST_DECLARE (spawn_stdio_greater_than_3)
TEST_DECLARE (spawn_ignored_stdio)
TEST_DECLARE (spawn_and_kill)
TEST_DECLARE (spawn_detached)
TEST_DECLARE (spawn_and_kill_with_std)
Expand Down Expand Up @@ -337,6 +338,7 @@ TASK_LIST_START
TEST_ENTRY (spawn_stdout)
TEST_ENTRY (spawn_stdin)
TEST_ENTRY (spawn_stdio_greater_than_3)
TEST_ENTRY (spawn_ignored_stdio)
TEST_ENTRY (spawn_and_kill)
TEST_ENTRY (spawn_detached)
TEST_ENTRY (spawn_and_kill_with_std)
Expand Down
21 changes: 21 additions & 0 deletions test/test-spawn.c
Expand Up @@ -329,6 +329,27 @@ TEST_IMPL(spawn_stdio_greater_than_3) {
}


TEST_IMPL(spawn_ignored_stdio) {
int r;

init_process_options("spawn_helper6", exit_cb);

options.stdio = NULL;
options.stdio_count = 0;

r = uv_spawn(uv_default_loop(), &process, options);
ASSERT(r == 0);

r = uv_run(uv_default_loop());
ASSERT(r == 0);

ASSERT(exit_cb_called == 1);
ASSERT(close_cb_called == 1);

return 0;
}


TEST_IMPL(spawn_and_kill) {
int r;

Expand Down

0 comments on commit 1cd9642

Please sign in to comment.