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.
This commit is contained in:
parent
7bacdcfc42
commit
5ba41de9ed
|
@ -1,3 +1,7 @@
|
||||||
|
2017-10-12 Szabolcs Nagy <szabolcs.nagy@arm.com>
|
||||||
|
|
||||||
|
* posix/tst-spawn.c (do_test): Wait for both children.
|
||||||
|
|
||||||
2017-10-12 H.J. Lu <hongjiu.lu@intel.com>
|
2017-10-12 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
[BZ #22284]
|
[BZ #22284]
|
||||||
|
|
|
@ -23,9 +23,10 @@
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <wait.h>
|
#include <wait.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <support/check.h>
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
|
|
||||||
/* Nonzero if the program gets called via `exec'. */
|
/* 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");
|
error (EXIT_FAILURE, errno, "posix_spawn_file_actions_destroy");
|
||||||
free (name3_copy);
|
free (name3_copy);
|
||||||
|
|
||||||
/* Wait for the child. */
|
/* Wait for the children. */
|
||||||
if (waitpid (pid, &status, 0) != pid)
|
TEST_VERIFY (xwaitpid (pid, &status, 0) == pid);
|
||||||
error (EXIT_FAILURE, errno, "wrong child");
|
TEST_VERIFY (WIFEXITED (status));
|
||||||
|
TEST_VERIFY (!WIFSIGNALED (status));
|
||||||
|
TEST_VERIFY (WEXITSTATUS (status) == 0);
|
||||||
|
|
||||||
if (WTERMSIG (status) != 0)
|
xwaitpid (-1, &status, 0);
|
||||||
error (EXIT_FAILURE, 0, "Child terminated incorrectly");
|
TEST_VERIFY (WIFEXITED (status));
|
||||||
status = WEXITSTATUS (status);
|
TEST_VERIFY (!WIFSIGNALED (status));
|
||||||
|
TEST_VERIFY (WEXITSTATUS (status) == 0);
|
||||||
|
|
||||||
return status;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue