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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@xxxxxxxxxxxxxxx>
---
 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




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux