[CRIU] [PATCH] test: zombie00 -- Extend information for waitpid error

Andrey Vagin avagin at virtuozzo.com
Tue Oct 25 10:13:47 PDT 2016


On Sat, Oct 22, 2016 at 06:21:16PM +0300, Cyrill Gorcunov wrote:
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  test/zdtm/static/zombie00.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/test/zdtm/static/zombie00.c b/test/zdtm/static/zombie00.c
> index df12a7046a2f..90aabef8ad2d 100644
> --- a/test/zdtm/static/zombie00.c
> +++ b/test/zdtm/static/zombie00.c
> @@ -77,8 +77,10 @@ int main(int argc, char ** argv)
>  	test_waitsig();
>  
>  	for (i = 0; i < NR_ZOMBIES; i++) {
> -		if (waitpid(zombie[i].pid, &status, 0) != zombie[i].pid) {
> -			fail("Exit with wrong pid\n");
status = -1;
> +		pid_t obtained = waitpid(zombie[i].pid, &status, 0);
> +		if (obtained != zombie[i].pid) {
> +			fail("Exit with wrong pid (expected %d but got %d)\n",
> +			     zombie[i].pid, obtained);

It's useless. waitpid(pid, ...) returns pid or -1. We need to print
status here.
>  			exit(1);
>  		}
>  
> -- 
> 2.7.4
> 


More information about the CRIU mailing list