[igt-dev] [PATCH v3 3/3] core_getversion: Test for desired device

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Sep 28 07:41:49 UTC 2023


Hi Helen,
On 2023-09-27 at 19:24:35 -0300, Helen Koike wrote:
> 
> 
> On 26/09/2023 15:47, 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_REQUIRED_DRIVER environment variable.
> > 
> > Signed-off-by: Rob Clark <robdclark at chromium.org>
> > Acked-by: Helen Koike <helen.koike at collabora.com>
> > ---
> >   tests/core_getversion.c | 13 ++++++++++++-
> >   1 file changed, 12 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/core_getversion.c b/tests/core_getversion.c
> > index 32cb976e4923..b298a6890ef9 100644
> > --- a/tests/core_getversion.c
> > +++ b/tests/core_getversion.c
> > @@ -48,14 +48,25 @@ igt_simple_main
> >   {
> >   	int fd;
> >   	drmVersionPtr v;
> > +	const char *name = getenv("IGT_REQUIRED_DRIVER");
---------------------------------------^^^^^^^^

Maybe better name would be IGT_EXPECTED_DRIVER? Or if this is
enviroment var for only this one test, maybe

IGT_CORE_GETVERSION_EXPECTED

> 
> Btw, In drm/ci we are using IGT_FORCE_DRIVER
> 
> https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/ci/igt_runner.sh#n6
> 
> You could use the same name here so we don't need to patch drm/ci (but
> patching there is not a issue as well, so feel free to ignore this comment
> and just chose the best name).
> 
> Regards,
> Helen

If used IGT_FORCE_DRIVER in CI or tests we may as well drop
line:
		chipset = drm_find_chipset(name);

and just use DRIVER_ANY:

    fd = drm_open_driver(DRIVER_ANY);

as in all kms tests.

Regards,
Kamil

> 
> > +	int chipset = DRIVER_ANY;
> > -	fd = drm_open_driver(DRIVER_ANY);
> > +	if (name)
> > +		chipset = drm_find_chipset(name);
> > +
> > +	fd = __drm_open_driver(chipset);
> > +	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);


More information about the igt-dev mailing list