[CRIU] [PATCH] zdtm/socket_close_data01: wait a child before c/r

Andrew Vagin avagin at virtuozzo.com
Tue Dec 22 03:57:15 PST 2015


On Tue, Dec 22, 2015 at 02:34:18PM +0300, Andrey Vagin wrote:
> From: Andrew Vagin <avagin at virtuozzo.com>
> 
> A static test should not change its state during C/R.
>

Cc: Kirill Tkhai <ktkhai at odin.com>

> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
> ---
>  test/zdtm/live/static/socket_close_data01.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/test/zdtm/live/static/socket_close_data01.c b/test/zdtm/live/static/socket_close_data01.c
> index 4ca5a08..53b5f7a 100644
> --- a/test/zdtm/live/static/socket_close_data01.c
> +++ b/test/zdtm/live/static/socket_close_data01.c
> @@ -70,6 +70,15 @@ int main(int argc, char **argv)
>  		client("(iter1)");
>  		exit(0);
>  	}
> +	ret = 1;
> +	if (wait(&status) == -1) {
> +		fail("wait failed");
> +		goto unlink;
> +	}
> +	if (status) {
> +		pr_err("A child exited with 0x%x\n", status);
> +		goto unlink;
> +	}
>  
>  	test_daemon();
>  	test_waitsig();
> @@ -83,12 +92,6 @@ int main(int argc, char **argv)
>  		goto unlink;
>  	}
>  
> -	ret = 1;
> -	if (wait(NULL) == -1) {
> -		fail("wait failed");
> -		goto unlink;
> -	}
> -
>  	/* Test2: check it's still possible to connect to the bound socket */
>  	if (fork() == 0) {
>  		exit(client("(iter2)"));
> -- 
> 2.4.3
> 


More information about the CRIU mailing list