[Intel-gfx] [PATCH i-g-t v6 19/21] tests/sw_sync: Add subtest test_sync_merge_invalid

Chris Wilson chris at chris-wilson.co.uk
Thu Nov 17 15:52:14 UTC 2016


On Thu, Nov 17, 2016 at 10:02:07AM -0500, robert.foss at collabora.com wrote:
> From: Robert Foss <robert.foss at collabora.com>
> 
> Add subtest test_sync_merge_invalid that tests merging invalid fences.
> 
> Signed-off-by: Robert Foss <robert.foss at collabora.com>
> ---
>  tests/sw_sync.c | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/tests/sw_sync.c b/tests/sw_sync.c
> index 0aae4dc..d60fb32 100644
> --- a/tests/sw_sync.c
> +++ b/tests/sw_sync.c
> @@ -155,6 +155,44 @@ static void test_sync_busy(void)
>  	close(timeline);
>  }
>  
> +static void test_sync_merge_invalid(void)
> +{
> +	int in_fence;
> +	int fence_invalid;
> +	int fence_merge;
> +	int timeline;
> +	char tmppath[] = "/tmp/igt-XXXXXX";
> +	int skip = 0;
> +
> +	timeline = sw_sync_timeline_create();
> +	in_fence = sw_sync_fence_create(timeline, 1);
> +
> +	fence_invalid = -1;
> +	fence_merge = sync_merge(in_fence, fence_invalid);
> +	igt_assert_f(fence_merge < 0, "Verify invalid fd (-1) handling");

For these you probably want:

int __sync_merge(int acc, int fd)
{
	int out;

	out = sync_merge(acc, fd);
	if (out < 0)
		out = -errno;
	return out;
}

then igt_assert_eq(__sync_merge(in_fence, -1), -EINVAL);

Or at least assert the errno is EINVAL.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list