[igt-dev] [PATCH i-g-t 2/3] xe/xe_mmap: Negative test to extensions

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon May 22 11:41:32 UTC 2023


On Sat, May 20, 2023 at 05:40:55PM +0530, priyanka.dandamudi at intel.com wrote:
> From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> 
> Add negative test to check bad extensions.
> 
> Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
> Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> ---
>  tests/xe/xe_mmap.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/tests/xe/xe_mmap.c b/tests/xe/xe_mmap.c
> index 011b8893..f6f6b2af 100644
> --- a/tests/xe/xe_mmap.c
> +++ b/tests/xe/xe_mmap.c
> @@ -73,6 +73,25 @@ static void test_bad_flags(int fd)
>  	gem_close(fd, mmo.handle);
>  }
>  
> +/**
> + * SUBTEST: bad-extensions
> + * Description: Test mmap offset with bad extensions.
> + *
> + */
> +static void test_bad_extensions(int fd)
> +{
> +	struct xe_user_extension ext;
> +	struct drm_xe_gem_mmap_offset mmo = {
> +		.handle = xe_bo_create(fd, 0, 0, 4096),

Same issue like in 1/3. Rest looks correct.

--
Zbigniew

> +	};
> +
> +	mmo.extensions = to_user_pointer(&ext);
> +	ext.name = -1;
> +
> +	do_ioctl_err(fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &mmo, EINVAL);
> +	gem_close(fd, mmo.handle);
> +}
> +
>  igt_main
>  {
>  	int fd;
> @@ -94,6 +113,9 @@ igt_main
>  	igt_subtest("bad-flags")
>  		test_bad_flags(fd);
>  
> +	igt_subtest("bad-extensions")
> +		test_bad_extensions(fd);
> +
>  	igt_fixture {
>  		xe_device_put(fd);
>  		close(fd);
> -- 
> 2.25.1
> 


More information about the igt-dev mailing list