Merge tag 'fixes-for-v4.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
[linux/fpc-iii.git] / tools / testing / selftests / kselftest.h
blob572c8888167a09b7c99da4d8d156e30a7f3f19f8
1 /*
2 * kselftest.h: kselftest framework return codes to include from
3 * selftests.
5 * Copyright (c) 2014 Shuah Khan <shuahkh@osg.samsung.com>
6 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
8 * This file is released under the GPLv2.
9 */
10 #ifndef __KSELFTEST_H
11 #define __KSELFTEST_H
13 #include <stdlib.h>
14 #include <unistd.h>
16 /* counters */
17 struct ksft_count {
18 unsigned int ksft_pass;
19 unsigned int ksft_fail;
20 unsigned int ksft_xfail;
21 unsigned int ksft_xpass;
22 unsigned int ksft_xskip;
25 static struct ksft_count ksft_cnt;
27 static inline void ksft_inc_pass_cnt(void) { ksft_cnt.ksft_pass++; }
28 static inline void ksft_inc_fail_cnt(void) { ksft_cnt.ksft_fail++; }
29 static inline void ksft_inc_xfail_cnt(void) { ksft_cnt.ksft_xfail++; }
30 static inline void ksft_inc_xpass_cnt(void) { ksft_cnt.ksft_xpass++; }
31 static inline void ksft_inc_xskip_cnt(void) { ksft_cnt.ksft_xskip++; }
33 static inline void ksft_print_cnts(void)
35 printf("Pass: %d Fail: %d Xfail: %d Xpass: %d, Xskip: %d\n",
36 ksft_cnt.ksft_pass, ksft_cnt.ksft_fail,
37 ksft_cnt.ksft_xfail, ksft_cnt.ksft_xpass,
38 ksft_cnt.ksft_xskip);
41 static inline int ksft_exit_pass(void)
43 exit(0);
45 static inline int ksft_exit_fail(void)
47 exit(1);
49 static inline int ksft_exit_xfail(void)
51 exit(2);
53 static inline int ksft_exit_xpass(void)
55 exit(3);
57 static inline int ksft_exit_skip(void)
59 exit(4);
62 #endif /* __KSELFTEST_H */