diff options
author | Darren Hart <dvhart@linux.intel.com> | 2015-05-13 00:07:56 -0400 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2015-05-26 17:58:08 -0400 |
commit | 4100e675a9be8974e00b5dd26be529136a31d519 (patch) | |
tree | ecdddaad1abab96d765920823f8fe149b547265d | |
parent | ecac1a7549f81e191588d08a46b81f057cb7cb2f (diff) |
kselftest: Add exit code defines
Define the exit codes with KSFT_PASS and similar so tests can use these
directly if they choose. Also enable harnesses and other tooling to use
the defines instead of hardcoding the return codes.
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: linux-api@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
-rw-r--r-- | tools/testing/selftests/kselftest.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 572c8888167a..ef1c80d67ac7 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h | |||
@@ -13,6 +13,13 @@ | |||
13 | #include <stdlib.h> | 13 | #include <stdlib.h> |
14 | #include <unistd.h> | 14 | #include <unistd.h> |
15 | 15 | ||
16 | /* define kselftest exit codes */ | ||
17 | #define KSFT_PASS 0 | ||
18 | #define KSFT_FAIL 1 | ||
19 | #define KSFT_XFAIL 2 | ||
20 | #define KSFT_XPASS 3 | ||
21 | #define KSFT_SKIP 4 | ||
22 | |||
16 | /* counters */ | 23 | /* counters */ |
17 | struct ksft_count { | 24 | struct ksft_count { |
18 | unsigned int ksft_pass; | 25 | unsigned int ksft_pass; |
@@ -40,23 +47,23 @@ static inline void ksft_print_cnts(void) | |||
40 | 47 | ||
41 | static inline int ksft_exit_pass(void) | 48 | static inline int ksft_exit_pass(void) |
42 | { | 49 | { |
43 | exit(0); | 50 | exit(KSFT_PASS); |
44 | } | 51 | } |
45 | static inline int ksft_exit_fail(void) | 52 | static inline int ksft_exit_fail(void) |
46 | { | 53 | { |
47 | exit(1); | 54 | exit(KSFT_FAIL); |
48 | } | 55 | } |
49 | static inline int ksft_exit_xfail(void) | 56 | static inline int ksft_exit_xfail(void) |
50 | { | 57 | { |
51 | exit(2); | 58 | exit(KSFT_XFAIL); |
52 | } | 59 | } |
53 | static inline int ksft_exit_xpass(void) | 60 | static inline int ksft_exit_xpass(void) |
54 | { | 61 | { |
55 | exit(3); | 62 | exit(KSFT_XPASS); |
56 | } | 63 | } |
57 | static inline int ksft_exit_skip(void) | 64 | static inline int ksft_exit_skip(void) |
58 | { | 65 | { |
59 | exit(4); | 66 | exit(KSFT_SKIP); |
60 | } | 67 | } |
61 | 68 | ||
62 | #endif /* __KSELFTEST_H */ | 69 | #endif /* __KSELFTEST_H */ |