From: Szabolcs Nagy Date: Tue, 26 Sep 2017 16:40:09 +0000 (+0100) Subject: fix posix/tst-spawn test X-Git-Tag: glibc-2.27~700 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ba41de9ed2cf6cf39a9cd7a7541bc71fc447d52;p=thirdparty%2Fglibc.git fix posix/tst-spawn test The test spawns two children but only waited for one. The fix avoids printing to stderr. * posix/tst-spawn.c (do_test): Wait for both children. --- diff --git a/ChangeLog b/ChangeLog index 7d1fbc66bed..58b28159d44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-10-12 Szabolcs Nagy + + * posix/tst-spawn.c (do_test): Wait for both children. + 2017-10-12 H.J. Lu [BZ #22284] diff --git a/posix/tst-spawn.c b/posix/tst-spawn.c index 08d92bd7a7a..4e5e76351cd 100644 --- a/posix/tst-spawn.c +++ b/posix/tst-spawn.c @@ -23,9 +23,10 @@ #include #include #include -#include #include #include +#include +#include /* Nonzero if the program gets called via `exec'. */ @@ -249,13 +250,16 @@ do_test (int argc, char *argv[]) error (EXIT_FAILURE, errno, "posix_spawn_file_actions_destroy"); free (name3_copy); - /* Wait for the child. */ - if (waitpid (pid, &status, 0) != pid) - error (EXIT_FAILURE, errno, "wrong child"); + /* Wait for the children. */ + TEST_VERIFY (xwaitpid (pid, &status, 0) == pid); + TEST_VERIFY (WIFEXITED (status)); + TEST_VERIFY (!WIFSIGNALED (status)); + TEST_VERIFY (WEXITSTATUS (status) == 0); - if (WTERMSIG (status) != 0) - error (EXIT_FAILURE, 0, "Child terminated incorrectly"); - status = WEXITSTATUS (status); + xwaitpid (-1, &status, 0); + TEST_VERIFY (WIFEXITED (status)); + TEST_VERIFY (!WIFSIGNALED (status)); + TEST_VERIFY (WEXITSTATUS (status) == 0); - return status; + return 0; }