Skip to content
Permalink
Browse files
kselftest: add support for skipped tests
Update the kselftest framework to all testing clients to
specify that some tests were skipped.

Signed-off-by: Timur Tabi <ttabi@nvidia.com>
  • Loading branch information
Timur Tabi authored and intel-lab-lkp committed Feb 10, 2021
1 parent b15ef16 commit 4387344bd9c51be401880f17c193e4956036c067
Showing 1 changed file with 12 additions and 6 deletions.
@@ -11,7 +11,8 @@

#define KSTM_MODULE_GLOBALS() \
static unsigned int total_tests __initdata; \
static unsigned int failed_tests __initdata
static unsigned int failed_tests __initdata; \
static unsigned int skipped_tests __initdata

#define KSTM_CHECK_ZERO(x) do { \
total_tests++; \
@@ -21,11 +22,16 @@ static unsigned int failed_tests __initdata
} \
} while (0)

static inline int kstm_report(unsigned int total_tests, unsigned int failed_tests)
static inline int kstm_report(unsigned int total_tests, unsigned int failed_tests,
unsigned int skipped_tests)
{
if (failed_tests == 0)
pr_info("all %u tests passed\n", total_tests);
else
if (failed_tests == 0) {
if (skipped_tests) {
pr_info("skipped %u tests\n", skipped_tests);
pr_info("remaining %u tests passed\n", total_tests);
} else
pr_info("all %u tests passed\n", total_tests);
} else
pr_warn("failed %u out of %u tests\n", failed_tests, total_tests);

return failed_tests ? -EINVAL : 0;
@@ -36,7 +42,7 @@ static int __init __module##_init(void) \
{ \
pr_info("loaded.\n"); \
selftest(); \
return kstm_report(total_tests, failed_tests); \
return kstm_report(total_tests, failed_tests, skipped_tests); \
} \
static void __exit __module##_exit(void) \
{ \

0 comments on commit 4387344

Please sign in to comment.