[PATCH] fix posix/tst-spawn test

Florian Weimer fweimer@redhat.com
Wed Sep 27 13:01:00 GMT 2017


On 09/27/2017 02:56 PM, Szabolcs Nagy wrote:
> +  /* Wait for the child.  */
> +  if (waitpid (pid, &status, 0) != pid)
> +    error (EXIT_FAILURE, errno, "wrong child");

You could use

   TEST_VERIFY (xwaitpid (pid, &status, 0) != pid));

instead.

In fact, all the error calls are invalid in tests because they write to 
standard error.

So perhaps use

   TEST_VERIFY (WIFEXITED (status));
   TEST_VERIFY (!WIFSIGNALED (status));
   TEST_VERIFY (WEXITSTATUS (status) == 0);

The error messages did not contain the status bits anyway, so this is 
not a regression as far as diagnostics are concerned.

The existing WTERMSIG check is invalid because !WIFSIGNALED (status).

Thanks,
Florian



More information about the Libc-alpha mailing list