xref: /linux/tools/testing/selftests/mm/mseal_helpers.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #define FAIL_TEST_IF_FALSE(test_passed)					\
4 	do {								\
5 		if (!(test_passed)) {					\
6 			ksft_test_result_fail("%s: line:%d\n",		\
7 						__func__, __LINE__);	\
8 			return;						\
9 		}							\
10 	} while (0)
11 
12 #define SKIP_TEST_IF_FALSE(test_passed)					\
13 	do {								\
14 		if (!(test_passed)) {					\
15 			ksft_test_result_skip("%s: line:%d\n",		\
16 						__func__, __LINE__);	\
17 			return;						\
18 		}							\
19 	} while (0)
20 
21 #define REPORT_TEST_PASS() ksft_test_result_pass("%s\n", __func__)
22 
23 #ifndef PKEY_DISABLE_ACCESS
24 #define PKEY_DISABLE_ACCESS	0x1
25 #endif
26 
27 #ifndef PKEY_DISABLE_WRITE
28 #define PKEY_DISABLE_WRITE	0x2
29 #endif
30 
31 #ifndef PKEY_BITS_PER_PKEY
32 #define PKEY_BITS_PER_PKEY	2
33 #endif
34 
35 #ifndef PKEY_MASK
36 #define PKEY_MASK	(PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE)
37 #endif
38 
39 #ifndef u64
40 #define u64 unsigned long long
41 #endif
42