[PATCH v2 0/7] Handle faults in KUnit tests

From: Mickaël Salaün
Date: Fri Mar 01 2024 - 14:41:01 EST


Hi,

This patch series teaches KUnit to handle kthread faults as errors, and
it brings a few related fixes and improvements.

I removed the previous patch that moved the KUnit test execution at the
very end of kernel initialization. We'll address that with a separate
series.

A new test case check NULL pointer dereference, which wasn't possible
before.

This is useful to test current kernel self-protection mechanisms or
future ones such as Heki: https://github.com/heki-linux

Previous version:
v1: https://lore.kernel.org/r/20240229170409.365386-1-mic@xxxxxxxxxxx

Regards,

Mickaël Salaün (7):
kunit: Handle thread creation error
kunit: Fix kthread reference
kunit: Fix timeout message
kunit: Handle test faults
kunit: Fix KUNIT_SUCCESS() calls in iov_iter tests
kunit: Print last test location on fault
kunit: Add tests for fault

include/kunit/test.h | 24 ++++++++++++++++++---
include/kunit/try-catch.h | 3 ---
lib/kunit/kunit-test.c | 45 ++++++++++++++++++++++++++++++++++++++-
lib/kunit/try-catch.c | 33 +++++++++++++++++-----------
lib/kunit_iov_iter.c | 18 ++++++++--------
5 files changed, 95 insertions(+), 28 deletions(-)


base-commit: d206a76d7d2726f3b096037f2079ce0bd3ba329b
--
2.44.0