[Intel-gfx] [PATCH i-g-t] igt/gem_exec_fence: Add subtest for invalid flags
Chris Wilson
chris at chris-wilson.co.uk
Fri Nov 3 12:04:56 UTC 2017
Quoting Tvrtko Ursulin (2017-11-03 11:57:54)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> We need to check that the kernel rejects attempts to pass in
> unknown flags.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> tests/gem_exec_fence.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c
> index 2a6da8b074a6..6ee944ffadda 100644
> --- a/tests/gem_exec_fence.c
> +++ b/tests/gem_exec_fence.c
> @@ -1017,6 +1017,34 @@ static void test_syncobj_invalid_wait(int fd)
> syncobj_destroy(fd, fence.handle);
> }
>
> +static void test_syncobj_invalid_flags(int fd)
> +{
> + const uint32_t bbe = MI_BATCH_BUFFER_END;
> + struct drm_i915_gem_exec_object2 obj;
> + struct drm_i915_gem_execbuffer2 execbuf;
> + struct local_gem_exec_fence fence = {
> + .handle = syncobj_create(fd),
> + };
> +
> + memset(&execbuf, 0, sizeof(execbuf));
> + execbuf.buffers_ptr = to_user_pointer(&obj);
> + execbuf.buffer_count = 1;
> + execbuf.flags = LOCAL_EXEC_FENCE_ARRAY;
> + execbuf.cliprects_ptr = to_user_pointer(&fence);
> + execbuf.num_cliprects = 1;
> +
> + memset(&obj, 0, sizeof(obj));
> + obj.handle = gem_create(fd, 4096);
> + gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
> +
> + /* set all flags to hit an invalid one */
> + fence.flags = ~0;
> + igt_assert_eq(__gem_execbuf(fd, &execbuf), -EINVAL);
> +
> + gem_close(fd, obj.handle);
> + syncobj_destroy(fd, fence.handle);
Ok. All suggestions I have here end up being kcov-afl.
This applies the rule that the execbuf is correct for all but the single
invalid field,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
More information about the Intel-gfx
mailing list