HID: hiddev: Fix slab-out-of-bounds write in hiddev_ioctl_usage()
[linux/fpc-iii.git] / tools / testing / selftests / kselftest.h
blobef1c80d67ac73307957e308a879eca1e556874fb
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 /* 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
23 /* counters */
24 struct ksft_count {
25 unsigned int ksft_pass;
26 unsigned int ksft_fail;
27 unsigned int ksft_xfail;
28 unsigned int ksft_xpass;
29 unsigned int ksft_xskip;
32 static struct ksft_count ksft_cnt;
34 static inline void ksft_inc_pass_cnt(void) { ksft_cnt.ksft_pass++; }
35 static inline void ksft_inc_fail_cnt(void) { ksft_cnt.ksft_fail++; }
36 static inline void ksft_inc_xfail_cnt(void) { ksft_cnt.ksft_xfail++; }
37 static inline void ksft_inc_xpass_cnt(void) { ksft_cnt.ksft_xpass++; }
38 static inline void ksft_inc_xskip_cnt(void) { ksft_cnt.ksft_xskip++; }
40 static inline void ksft_print_cnts(void)
42 printf("Pass: %d Fail: %d Xfail: %d Xpass: %d, Xskip: %d\n",
43 ksft_cnt.ksft_pass, ksft_cnt.ksft_fail,
44 ksft_cnt.ksft_xfail, ksft_cnt.ksft_xpass,
45 ksft_cnt.ksft_xskip);
48 static inline int ksft_exit_pass(void)
50 exit(KSFT_PASS);
52 static inline int ksft_exit_fail(void)
54 exit(KSFT_FAIL);
56 static inline int ksft_exit_xfail(void)
58 exit(KSFT_XFAIL);
60 static inline int ksft_exit_xpass(void)
62 exit(KSFT_XPASS);
64 static inline int ksft_exit_skip(void)
66 exit(KSFT_SKIP);
69 #endif /* __KSELFTEST_H */