[PATCH i-g-t v1] tests/core_getversion: test all drm devices

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Tue May 21 10:26:42 UTC 2024


On Fri, 17 May 2024 21:09:55 +0200
Kamil Konieczny <kamil.konieczny at linux.intel.com> wrote:

> Check all drm devices in all-cards subtest.
> 
> v2: add define for number of max tested cards (Helen)
> v3: remove define as opening function from drmtest will
>   stop after opening all existing drm cards (Kamil)
>   changed subtest name to all-cards (Kamil)
> 
> Cc: Helen Koike <helen.koike at collabora.com>
> Cc: Mauro Carvalho Chehab <mchehab at kernel.org>
> Cc: Mauro Carvalho Chehab <mauro.chehab at linux.intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

LGTM.

Reviewed-by: Mauro Carvalho Chehab <mchehab at kernel.org>

> ---
>  tests/core_getversion.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/tests/core_getversion.c b/tests/core_getversion.c
> index bb2e6013d..8198f5f7f 100644
> --- a/tests/core_getversion.c
> +++ b/tests/core_getversion.c
> @@ -40,6 +40,9 @@
>   *
>   * SUBTEST: basic
>   * Description: Tests GET_VERSION ioctl of the first device.
> + *
> + * SUBTEST: all-cards
> + * Description: Tests GET_VERSION ioctl for all drm devices.
>   */
>  
>  IGT_TEST_DESCRIPTION("Tests the DRM_IOCTL_GET_VERSION ioctl and libdrm's "
> @@ -62,6 +65,22 @@ static void check(int fd, char *dst, int len)
>  	drmFree(v);
>  }
>  
> +static void check_all_drm(void)
> +{
> +	char info[256];
> +	int fd2;
> +
> +	for (int i = 0; ; i++) {
> +		fd2 = __drm_open_driver_another(i, DRIVER_ANY);
> +		if (fd2 == -1)
> +			break;
> +
> +		check(fd2, info, sizeof(info));
> +		igt_info("%d: %s\n", i, info);
> +		drm_close_driver(fd2);
> +	}
> +}
> +
>  igt_main
>  {
>  	char info[256];
> @@ -78,6 +97,10 @@ igt_main
>  		igt_info("0: %s\n", info);
>  	}
>  
> +	igt_describe("Check GET_VERSION ioctl for all drm devices.");
> +	igt_subtest("all-cards")
> +		check_all_drm();
> +
>  	igt_fixture
>  		drm_close_driver(fd);
>  }


More information about the igt-dev mailing list