[PATCH v2 0/5] selftests: harness: Detect illegal mixing of kselftest and harness functionality

Thomas Weißschuh posted 5 patches 1 month ago
tools/testing/selftests/kselftest.h                | 12 +++++
tools/testing/selftests/kselftest_harness.h        |  9 ++++
.../selftests/kselftest_harness/harness-selftest.c | 40 +++++++++++++++++
.../kselftest_harness/harness-selftest.expected    | 52 ++++++++++++++++++----
4 files changed, 104 insertions(+), 9 deletions(-)
[PATCH v2 0/5] selftests: harness: Detect illegal mixing of kselftest and harness functionality
Posted by Thomas Weißschuh 1 month ago
Users may accidentally use the kselftest_test_result_*() functions in
their harness tests. If ksft_finished() is not used, the results
reported in this way are silently ignored.

Detect such cases and fail the test.

This should probably only go in during the next cycle.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Changes in v2:
- Rebase on v7.0-rc1
- Remove spurious comma after the definition of ksft_reset_state()
- Link to v1: https://lore.kernel.org/r/20260128-kselftest-harness-v1-0-cb259fa81cd0@linutronix.de

---
Thomas Weißschuh (5):
      selftests: kselftest: Treat xpass as successful result
      selftests: harness: Validate that explicit kselftest exitcodes are handled
      selftests: kselftest: Add ksft_reset_state()
      selftests: harness: Detect illegal mixing of kselftest and harness functionality
      selftests: harness: Validate intermixing of kselftest and harness functionality

 tools/testing/selftests/kselftest.h                | 12 +++++
 tools/testing/selftests/kselftest_harness.h        |  9 ++++
 .../selftests/kselftest_harness/harness-selftest.c | 40 +++++++++++++++++
 .../kselftest_harness/harness-selftest.expected    | 52 ++++++++++++++++++----
 4 files changed, 104 insertions(+), 9 deletions(-)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260128-kselftest-harness-5e07ab07f58a

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh@linutronix.de>

Re: [PATCH v2 0/5] selftests: harness: Detect illegal mixing of kselftest and harness functionality
Posted by Shuah Khan 2 days, 2 hours ago
On 3/2/26 07:13, Thomas Weißschuh wrote:
> Users may accidentally use the kselftest_test_result_*() functions in
> their harness tests. If ksft_finished() is not used, the results
> reported in this way are silently ignored.
> 
> Detect such cases and fail the test.
> 
> This should probably only go in during the next cycle.
> 
Applied to linux-kselftest next for Linux 7.1-rc1

thanks,
-- Shuah