[PATCH i-g-t 1/3] lib/kunit: Fix selective execution of test cases

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon Jul 22 08:44:36 UTC 2024


On Mon, Jul 22, 2024 at 10:01:02AM +0200, Janusz Krzysztofik wrote:
> An issue has been discovered when running an IGT kunit test with a dynamic
> sub-subtest specified: only the first kunit test case of a test suite can
> be actually executed.  Selecting a test case other than the first one
> results in "Unloading test module failed, not executing more selftests."
> message being displayed and no single test case (dynamic sub-subtest)
> executed.
> 
> To avoid the failure from a consecutive module unload attempt after it has
> been already unloaded, unload the test module neither after geting a list
> of test cases, nor after each leaving of igt_dynamic() section, only as a
> first step of each dynamic sub-subtest body.
> 
> Reported-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>

Works perfect now, thanks for the fix.

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

--
Zbigniew

> ---
>  lib/igt_kmod.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
> index 33f059199f..5864be29d2 100644
> --- a/lib/igt_kmod.c
> +++ b/lib/igt_kmod.c
> @@ -1328,8 +1328,6 @@ static bool kunit_get_tests(struct igt_list_head *tests,
>  		igt_require_f(r->code == IGT_EXIT_SKIP,
>  			      "Unexpected non-SKIP result while listing test cases\n");
>  
> -	igt_skip_on(kmod_module_remove_module(tst->kmod, 0));
> -
>  	return true;
>  }
>  
> @@ -1356,6 +1354,8 @@ static void __igt_kunit(struct igt_ktest *tst,
>  			char glob[1024];
>  			int i;
>  
> +			igt_skip_on(kmod_module_remove_module(tst->kmod,
> +							      KMOD_REMOVE_FORCE));
>  			igt_skip_on(igt_kernel_tainted(&taints));
>  
>  			igt_assert_lt(snprintf(glob, sizeof(glob), "%s.%s",
> @@ -1412,12 +1412,6 @@ static void __igt_kunit(struct igt_ktest *tst,
>  			igt_info("Kernel tainted, not executing more selftests.\n");
>  			break;
>  		}
> -
> -		if (igt_debug_on(kmod_module_remove_module(tst->kmod,
> -							   KMOD_REMOVE_FORCE))) {
> -			igt_info("Unloading test module failed, not executing more selftests.\n");
> -			break;
> -		}
>  	}
>  }
>  
> -- 
> 2.45.2
> 


More information about the igt-dev mailing list