[igt-dev] [PATCH i-g-t 3/3] xe/xe_mmap: Negative test to object
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Mon May 22 11:44:20 UTC 2023
On Sat, May 20, 2023 at 05:40:56PM +0530, priyanka.dandamudi at intel.com wrote:
> From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
>
> Add negative test to check bad object.
>
> 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>
> ---
> tests/xe/xe_mmap.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/tests/xe/xe_mmap.c b/tests/xe/xe_mmap.c
> index f6f6b2af..95672e5d 100644
> --- a/tests/xe/xe_mmap.c
> +++ b/tests/xe/xe_mmap.c
> @@ -92,6 +92,24 @@ 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)
> +{
> + struct drm_xe_gem_mmap_offset mmo = {
> + .handle = xe_bo_create(fd, 0, 0, 4096),
> + };
> +
> + igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &mmo), 0);
> + gem_close(fd, mmo.handle);
I'm not sure what for is positive create/mmap here? I think simple
invalid handle should be enough to check this uapi.
--
Zbigniew
> +
> + mmo.handle = 0xdeadbeef;
> + do_ioctl_err(fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &mmo, ENOENT);
> +}
> +
> igt_main
> {
> int fd;
> @@ -116,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