[igt-dev] [PATCH v5] core_getversion: Test for desired device

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Oct 5 08:09:41 UTC 2023


Hi Rob,
On 2023-10-04 at 10:21:19 -0700, Rob Clark wrote:
> From: Rob Clark <robdclark at chromium.org>
> 
> We discovered in drm/ci that if the drm device fails to probe, all the
> tests come back as "Skip" and the job is considered successful. Fix
> the getversion test to fail if there is no drm device or if the drm
> device does not match the expected device as specified by the optional
> IGT_FORCE_DRIVER environment variable.
> 
> Signed-off-by: Rob Clark <robdclark at chromium.org>
> Acked-by: Helen Koike <helen.koike at collabora.com>
> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Tested-by: Helen Koike <helen.koike at collabora.com>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  tests/core_getversion.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/core_getversion.c b/tests/core_getversion.c
> index 32cb976e4923..8c8e0c9a3e5e 100644
> --- a/tests/core_getversion.c
> +++ b/tests/core_getversion.c
> @@ -48,14 +48,21 @@ igt_simple_main
>  {
>  	int fd;
>  	drmVersionPtr v;
> +	const char *name = getenv("IGT_FORCE_DRIVER");
>  
> -	fd = drm_open_driver(DRIVER_ANY);
> +	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);
>  	igt_assert_neq(strlen(v->desc), 0);
>  	if (is_i915_device(fd))
>  		igt_assert_lte(1, v->version_major);
> +	if (name) {
> +		igt_assert_f(!strcmp(name, v->name),
> +			     "Expected driver \"%s\" but got \"%s\"\n",
> +			     name, v->name);
> +	}
>  
>  	drmFree(v);
>  	drm_close_driver(fd);
> -- 
> 2.41.0
> 


More information about the igt-dev mailing list