[PATCH i-g-t v2 6/6] lib/kunit: Process module remove error after list errors

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Feb 1 16:59:07 UTC 2024


Hi Janusz,
On 2024-02-01 at 17:02:05 +0100, Janusz Krzysztofik wrote:
> Hi Kamil,
> 
> On Thursday, 1 February 2024 15:55:01 CET Kamil Konieczny wrote:
> > Hi Janusz,
> > On 2024-01-31 at 19:03:53 +0100, Janusz Krzysztofik wrote:
> > > Skip on any error from test case list gathering first, then, in
> > > preparation for executing those test cases, on an error from unloading the
> > > test module loaded in list only mode, so it is more clear if listing the
> > > test cases was successful or not.
> > > 
> > > Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
> > > ---
> > >  lib/igt_kmod.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
> > > index 53c54b1a0d..741c7fd055 100644
> > > --- a/lib/igt_kmod.c
> > > +++ b/lib/igt_kmod.c
> > > @@ -1225,11 +1225,11 @@ static void kunit_get_tests(struct igt_list_head 
> *tests,
> > >  		free(case_name);
> > >  	}
> > >  
> > > -	igt_skip_on(kmod_module_remove_module(tst->kmod, 
> KMOD_REMOVE_FORCE));
> > > -
> > >  	igt_skip_on_f(err,
> > >  		      "KTAP parser failed while getting a list of test 
> cases\n");
> > >  	igt_skip_on(igt_list_empty(tests));
> > 
> > This skip_on will prevent module unload below... What about
> > remembering both and skipping on list_empty() only after module unload?
> > For example:
> >     testslist_is_empty = igt_list_empty(tests);
> >     unload_failed = kmod_module_remove_module(tst->kmod, KMOD_REMOVE_FORCE);
> > 
> >     igt_skip_on(testslist_is_empty);
> >     igt_skip_on_f(unload_failed, "kmod %s unload failed\n", tst->kmod);
> 
> As I tried to express in my commit description, test module is unloaded here, 
> after the list of test cases is collected, "in preparation for executing those 
> test cases", and not as a final cleanup.
> 
> kunit_get_tests() is called from inside igt_subtest_with_dynamic() before any 
> calls to igt_dynamic() from where test cases are executed.  If 
> kunit_get_tests() skips for any reason then no test cases provided by that 
> module will be executed, then unloading the module is not required.  An 
> attempt to unload it if still loaded will be take from the trailing 
> igt_fixture section of igt_kunit() via a call to igt_ktest_end().
> 
> Is the above clarification sufficient for you?  
> 
> Thanks,
> Janusz

ok, thank you for explaining this,

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

> 
> > 
> > 
> > Regards,
> > Kamil
> > 
> > > +
> > > +	igt_skip_on(kmod_module_remove_module(tst->kmod, 
> KMOD_REMOVE_FORCE));
> > >  }
> > >  
> > >  static void __igt_kunit(struct igt_ktest *tst,
> > 
> 
> 
> 
> 


More information about the igt-dev mailing list