diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2017-07-24 13:55:18 -0600 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2017-07-28 13:20:19 -0600 |
commit | 1d3ee8bef9549ec8c16223de452f2e08b81f83d9 (patch) | |
tree | 5fa0c68fb26cf6a37ac54cdead7d915c228b281c /tools/testing/selftests/kselftest.h | |
parent | f6c44bbb79aa875d60dbd29ed1fa63923fb1fe81 (diff) | |
download | linux-1d3ee8bef9549ec8c16223de452f2e08b81f83d9.tar.gz linux-1d3ee8bef9549ec8c16223de452f2e08b81f83d9.tar.bz2 linux-1d3ee8bef9549ec8c16223de452f2e08b81f83d9.zip |
selftests: kselftest framework: add API to return pass/fail/* counts
Some tests print final pass/fail message based on fail count. Add
ksft_get_*_cnt() API to kselftest framework to return counts.
Update ksft_print_cnts() to print the test results summary message with
individual pass, fail, ... counters.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Diffstat (limited to 'tools/testing/selftests/kselftest.h')
-rw-r--r-- | tools/testing/selftests/kselftest.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 08e90c2cc5cb..45bf25905279 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h @@ -45,6 +45,12 @@ static inline void ksft_inc_xfail_cnt(void) { ksft_cnt.ksft_xfail++; } static inline void ksft_inc_xpass_cnt(void) { ksft_cnt.ksft_xpass++; } static inline void ksft_inc_xskip_cnt(void) { ksft_cnt.ksft_xskip++; } +static inline int ksft_get_pass_cnt(void) { return ksft_cnt.ksft_pass; } +static inline int ksft_get_fail_cnt(void) { return ksft_cnt.ksft_fail; } +static inline int ksft_get_xfail_cnt(void) { return ksft_cnt.ksft_xfail; } +static inline int ksft_get_xpass_cnt(void) { return ksft_cnt.ksft_xpass; } +static inline int ksft_get_xskip_cnt(void) { return ksft_cnt.ksft_xskip; } + static inline void ksft_print_header(void) { printf("TAP version 13\n"); @@ -52,6 +58,10 @@ static inline void ksft_print_header(void) static inline void ksft_print_cnts(void) { + printf("Pass %d Fail %d Xfail %d Xpass %d Skip %d\n", + ksft_cnt.ksft_pass, ksft_cnt.ksft_fail, + ksft_cnt.ksft_xfail, ksft_cnt.ksft_xpass, + ksft_cnt.ksft_xskip); printf("1..%d\n", ksft_test_num()); } |