[Intel-gfx] [PATCH i-g-t 2/2] tests: apply igt.cocci

Chris Wilson chris at chris-wilson.co.uk
Mon Mar 30 08:59:10 PDT 2015


On Mon, Mar 30, 2015 at 04:53:38PM +0100, Thomas Wood wrote:
> diff --git a/tests/eviction_common.c b/tests/eviction_common.c
> index 4fa5c04..9e06cbb 100644
> --- a/tests/eviction_common.c
> +++ b/tests/eviction_common.c
> @@ -200,18 +200,19 @@ static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops,
>  			ops->close(fd, bo[n]);
>  
>  out:
> -		write(result[1], &ret, sizeof(ret));
> +		igt_assert_eq(write(result[1], &ret, sizeof(ret)),
> +			      sizeof(ret));
>  	}
>  
>  	igt_waitchildren();
>  
>  	fcntl(result[0], F_SETFL, fcntl(result[0], F_GETFL) | O_NONBLOCK);
> -	read(result[0], &ret, sizeof(ret));
> +	igt_assert_eq(read(result[0], &ret, sizeof(ret)), sizeof(ret));

No. This read() may return -1 (with ret then being == -1 due to the
earlier initialisation) if the child is killed by a sigbus....

Hah, and now I realise my overcomplication, if we just get the status
back via igt_waitchildren passing the result back via a pipe is silly.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list