[igt-dev] [RFC 2/4] tests/i915/gem_mmap: Add invalid parameters tests

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 12 22:02:06 UTC 2019


Quoting Antonio Argenziano (2019-03-12 21:57:36)
> Add a couple of tests that supply invalid parameters to the mmap IOCTL.
> 
> Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
> ---
>  tests/i915/gem_mmap.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c
> index 0ed15878..2a676b9a 100644
> --- a/tests/i915/gem_mmap.c
> +++ b/tests/i915/gem_mmap.c
> @@ -136,6 +136,24 @@ igt_main
>                 igt_assert(ret == -1 && errno == ENOENT);
>         }
>  
> +       igt_subtest("bad-offset") {
> +               memset(&arg, 0, sizeof(arg));
> +               arg.handle = gem_create(fd, 4096);
> +               arg.offset = 4096 + 1;
> +               arg.size = 4096;
> +               ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
> +               igt_assert(ret == -1 && errno == EINVAL);

Also arg.offset = -size is a good one.

Then size=8192 and arg.offset=-4096;

> +       }
> +
> +       igt_subtest("bad-size") {
> +               memset(&arg, 0, sizeof(arg));
> +               arg.handle = gem_create(fd, 4096);
> +               arg.offset = 4096;
> +               arg.size = 0;
> +               ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
> +               igt_assert(ret == -1 && errno == EINVAL);

Also >4096, -4096
-Chris


More information about the igt-dev mailing list