[igt-dev] [PATCH i-g-t v2 4/4] tests: DRM selftests: switch to KUnit

Petri Latvala petri.latvala at intel.com
Tue Nov 1 13:16:02 UTC 2022


On Tue, Nov 01, 2022 at 01:54:25PM +0100, Mauro Carvalho Chehab wrote:
> On Tue, 20 Sep 2022 11:18:25 +0300
> Petri Latvala <petri.latvala at intel.com> wrote:
> 
> > On Sun, Aug 28, 2022 at 09:09:20PM -0300, Isabella Basso wrote:
> > > As the DRM selftests are now using KUnit [1], update IGT tests as well.
> > > 
> > > [1] - https://lore.kernel.org/all/20220708203052.236290-1-maira.canal@usp.br/
> > > 
> > > Signed-off-by: Isabella Basso <isabbasso at riseup.net>
> > > ---
> > >  tests/drm_buddy.c    |  7 ++++---
> > >  tests/drm_mm.c       |  7 ++++---
> > >  tests/kms_selftest.c | 12 +++++++++---
> > >  3 files changed, 17 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/tests/drm_buddy.c b/tests/drm_buddy.c
> > > index 06876e0c..74c06dce 100644
> > > --- a/tests/drm_buddy.c
> > > +++ b/tests/drm_buddy.c
> > > @@ -6,9 +6,10 @@
> > >  #include "igt.h"
> > >  #include "igt_kmod.h"
> > >  
> > > -IGT_TEST_DESCRIPTION("Basic sanity check of DRM's buddy allocator (struct drm_buddy)");
> > > +IGT_TEST_DESCRIPTION("Basic sanity check of DRM's buddy allocator (struct \
> > > +		      drm_buddy) using KUnit");
> > >  
> > > -igt_main
> > > +igt_simple_main
> > >  {
> > > -	igt_kselftests("test-drm_buddy", NULL, NULL, NULL);
> > > +	igt_kunit("drm_buddy_test", NULL);
> > >  }  
> > 
> > With kselftests we had the ability to only run a specified set of
> > tests, and with or without selection, we had sub-results for each
> > through dynamic subtests. Does kunit have that possibility? I mean I
> > know kunit itself does but what about igt_kunit()?
> 
> I don't think so. I created a KUnit with the mock selftests:
> 
> 	$ modinfo test-i915-mock
> 	filename:       /lib/modules/6.1.0-rc2-drm-b1cab854a639+/kernel/drivers/gpu/drm/i915/test-i915-mock.ko
> 	import_ns:      I915_SELFTEST
> 	license:        GPL v2
> 	depends:        i915
> 	retpoline:      Y
> 	intree:         Y
> 	name:           test_i915_mock
> 	vermagic:       6.1.0-rc2-drm-b1cab854a639+ SMP preempt mod_unload 
> 
> There's no module parameters. Just loading it makes all tests
> there to run.

Ah, the selection is in kunit.ko itself. kunit.filter_glob, set from
kunit.py with

positional arguments:
  filter_glob           Filter which KUnit test suites/tests run at boot-time, e.g. list* or list*.*del_test



-- 
Petri Latvala


More information about the dri-devel mailing list