2 #define _XOPEN_SOURCE 700
13 #define TEST(f, x) (void)( \
15 t_error("%s failed, got %d want %d\n", #f, r, x) )
17 #define TEST_E(f) (void)( \
19 t_error("%s failed (errno = %d \"%s\")\n", #f, errno, strerror(errno)) )
28 posix_spawn_file_actions_t fa
;
31 TEST(posix_spawn_file_actions_init(&fa
), 0);
32 TEST(posix_spawn_file_actions_addclose(&fa
, p
[0]), 0);
33 TEST(posix_spawn_file_actions_adddup2(&fa
, p
[1], 1), 0);
34 TEST(posix_spawn_file_actions_addclose(&fa
, p
[1]), 0);
35 TEST(posix_spawnp(&pid
, "echo", &fa
, 0, (char *[]){"echo","hello",0}, 0), 0);
37 TEST(waitpid(pid
, &status
, 0), pid
);
38 TEST(read(p
[0], foo
, sizeof foo
), 6);
40 TEST(posix_spawn_file_actions_destroy(&fa
), 0);