[igt-dev] [PATCH i-g-t 11/17] lib/kunit: Fail / skip on kernel taint
Janusz Krzysztofik
janusz.krzysztofik at linux.intel.com
Fri Sep 8 10:44:50 UTC 2023
Similar to how igt_kselftest() handles kernel taints, fail current dynamic
sub-subtest and skip remaining ones when a kernel taint is detected during
execution of kunit test cases.
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
lib/igt_kmod.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 020df286b8..988ac164cb 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -761,6 +761,7 @@ static void __igt_kunit(struct igt_ktest *tst, const char *opts)
bool is_builtin;
struct ktap_test_results *results;
struct ktap_test_results_element *temp;
+ unsigned long taints;
int flags, ret;
igt_skip_on_f(tst->kmsg < 0, "Could not open /dev/kmsg\n");
@@ -785,12 +786,20 @@ static void __igt_kunit(struct igt_ktest *tst, const char *opts)
while (READ_ONCE(results->still_running) || READ_ONCE(results->head) != NULL)
{
+ if (igt_kernel_tainted(&taints)) {
+ ktap_parser_cancel();
+ break;
+ }
+
if (READ_ONCE(results->head) != NULL) {
pthread_mutex_lock(&results->mutex);
- igt_dynamic(results->head->test_name)
+ igt_dynamic(results->head->test_name) {
igt_assert(READ_ONCE(results->head->passed));
+ igt_fail_on(igt_kernel_tainted(&taints));
+ }
+
temp = results->head;
results->head = results->head->next;
free(temp);
@@ -801,6 +810,7 @@ static void __igt_kunit(struct igt_ktest *tst, const char *opts)
ret = ktap_parser_stop();
+ igt_skip_on(igt_kernel_tainted(&taints));
igt_skip_on_f(ret, "KTAP parser failed\n");
}
--
2.41.0
More information about the igt-dev
mailing list