[PATCH wayland] test-runner: wait for concrete pid

Jon A. Cruz jonc at osg.samsung.com
Mon Feb 2 16:22:37 PST 2015


Hi Marek,

That change looks good (I'll assume you've observed it improve behavior
in your use scenarios).

I seem to recall some ugliness in this general area when correcting
tests for some other project under Google test (daemon development,
signal masking and other such), but those should be separate from the
issue addressed by this patch.

Reviewed-by: Jon A. Cruz <jonc at osg.samsung.com>

On 02/02/2015 01:40 AM, Marek Chalupa wrote:
> After running a test in fork, we were waiting for any child to terminate.
> It is OK unless the child forks again. If the child calls fork, the waitid can
> catch the child's child termination, stop block and run another test
> while the former test is still running. This is racy i. e. when adding socket.
> Since we have test compositor which uses fork, this situation can occur
> pretty frequently.
> 
> Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
> ---
>  tests/test-runner.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/test-runner.c b/tests/test-runner.c
> index 70fa0ae..0412e85 100644
> --- a/tests/test-runner.c
> +++ b/tests/test-runner.c
> @@ -351,7 +351,7 @@ int main(int argc, char *argv[])
>  		if (pid == 0)
>  			run_test(t); /* never returns */
>  
> -		if (waitid(P_ALL, 0, &info, WEXITED)) {
> +		if (waitid(P_PID, pid, &info, WEXITED)) {
>  			stderr_set_color(RED);
>  			fprintf(stderr, "waitid failed: %m\n");
>  			stderr_reset_color();
> 


More information about the wayland-devel mailing list