[PATCH 3/5] selftests: kselftest: Add ksft_reset_state()
From: Thomas Weißschuh
Date: Wed Jan 28 2026 - 05:25:00 EST
Add a helper to reset the internal state of the kselftest framework.
It will be used by the selftest harness.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
tools/testing/selftests/kselftest.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 1e7e73f77fa7..7979d6904ac6 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -476,4 +476,15 @@ static inline int ksft_min_kernel_version(unsigned int min_major,
return major > min_major || (major == min_major && minor >= min_minor);
}
+static inline void ksft_reset_state(void)
+{
+ ksft_cnt.ksft_pass = 0;
+ ksft_cnt.ksft_fail = 0;
+ ksft_cnt.ksft_xfail = 0;
+ ksft_cnt.ksft_xpass = 0;
+ ksft_cnt.ksft_xskip = 0;
+ ksft_cnt.ksft_error = 0;
+ ksft_plan = 0;
+};
+
#endif /* __KSELFTEST_H */
--
2.52.0