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

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri May 26 10:44:48 UTC 2023


On Fri, May 26, 2023 at 10:38:55AM +0530, priyanka.dandamudi at intel.com wrote:
> From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> 
> Add negative test to check bad object.
> 
> v2: Add default alignment for the object size
>  and remove positive case.(Zbigniew)
> 
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
> Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

--
Zbigniew

> ---
>  tests/xe/xe_mmap.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/tests/xe/xe_mmap.c b/tests/xe/xe_mmap.c
> index a5da6fa9..be1f9791 100644
> --- a/tests/xe/xe_mmap.c
> +++ b/tests/xe/xe_mmap.c
> @@ -94,6 +94,22 @@ static void test_bad_extensions(int fd)
>  	gem_close(fd, mmo.handle);
>  }
>  
> +/**
> + * SUBTEST: bad-object
> + * Description: Test mmap offset with bad object.
> + *
> + */
> +static void test_bad_object(int fd)
> +{
> +	uint64_t size = xe_get_default_alignment(fd);
> +	struct drm_xe_gem_mmap_offset mmo = {
> +		.handle = xe_bo_create(fd, 0, 0, size),
> +	};
> +
> +	mmo.handle = 0xdeadbeef;
> +	do_ioctl_err(fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &mmo, ENOENT);
> +}
> +
>  igt_main
>  {
>  	int fd;
> @@ -118,6 +134,9 @@ igt_main
>  	igt_subtest("bad-extensions")
>  		test_bad_extensions(fd);
>  
> +	igt_subtest("bad-object")
> +		test_bad_object(fd);
> +
>  	igt_fixture {
>  		xe_device_put(fd);
>  		close(fd);
> -- 
> 2.25.1
> 


More information about the igt-dev mailing list