summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kselftest.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/kselftest.h')
-rw-r--r--tools/testing/selftests/kselftest.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index afbcf8412ae5..ae18c491ae53 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -346,9 +346,9 @@ void ksft_test_result_code(int exit_code, const char *test_name,
}
/**
- * ksft_test_result() - Report test success based on truth of condition
+ * ksft_test_result_report() - Report test result based on a kselftest exit code
*
- * @condition: if true, report test success, otherwise failure.
+ * @result: a kselftest exit code
*/
#define ksft_test_result_report(result, fmt, ...) do { \
switch (result) { \
@@ -399,6 +399,7 @@ static inline __noreturn void ksft_exit_fail(void)
#define ksft_finished() \
ksft_exit(ksft_plan == \
ksft_cnt.ksft_pass + \
+ ksft_cnt.ksft_xpass + \
ksft_cnt.ksft_xfail + \
ksft_cnt.ksft_xskip)
@@ -449,7 +450,7 @@ static inline __noreturn __printf(1, 2) void ksft_exit_skip(const char *msg, ...
*/
if (ksft_plan || ksft_test_num()) {
ksft_cnt.ksft_xskip++;
- printf("ok %u # SKIP ", 1 + ksft_test_num());
+ printf("ok %u # SKIP ", ksft_test_num());
} else {
printf("1..0 # SKIP ");
}
@@ -475,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 */