[PATCH i-g-t v2 1/3] tests/core_getversion: convert to subtest

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Wed Mar 13 13:57:04 UTC 2024


On Wed, 21 Feb 2024 11:29:27 +0100
Kamil Konieczny <kamil.konieczny at linux.intel.com> wrote:

> Create one basic subtest with the ioctl check.
> 
> Cc: Helen Koike <helen.koike at collabora.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

Reviewed-by: Mauro Carvalho Chehab <mchehab at kernel.org>
> ---
>  tests/core_getversion.c | 26 ++++++++++++++++++++------
>  1 file changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/core_getversion.c b/tests/core_getversion.c
> index 9945c3855..6ec223eef 100644
> --- a/tests/core_getversion.c
> +++ b/tests/core_getversion.c
> @@ -38,19 +38,17 @@
>   * Sub-category: DRM
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST:
> + * SUBTEST: basic
> + * Description: Tests GET_VERSION ioctl of the first device.
>   */
>  
>  IGT_TEST_DESCRIPTION("Tests the DRM_IOCTL_GET_VERSION ioctl and libdrm's "
>  		     "drmGetVersion() interface to it.");
>  
> -igt_simple_main
> +static void check(int fd)
>  {
> -	int fd;
>  	drmVersionPtr v;
>  
> -	fd = __drm_open_driver(DRIVER_ANY);
> -	igt_assert_fd(fd);
>  	v = drmGetVersion(fd);
>  	igt_assert_neq(strlen(v->name), 0);
>  	igt_assert_neq(strlen(v->date), 0);
> @@ -59,5 +57,21 @@ igt_simple_main
>  		igt_assert_lte(1, v->version_major);
>  
>  	drmFree(v);
> -	drm_close_driver(fd);
> +}
> +
> +igt_main
> +{
> +	int fd;
> +
> +	igt_fixture {
> +		fd = __drm_open_driver(DRIVER_ANY);
> +		igt_assert_fd(fd);
> +	}
> +
> +	igt_describe("Check GET_VERSION ioctl of the first drm device.");
> +	igt_subtest("basic")
> +		check(fd);
> +
> +	igt_fixture
> +		drm_close_driver(fd);
>  }


More information about the igt-dev mailing list