diff options
Diffstat (limited to '')
-rw-r--r-- | src/regress/lib/libc/sys/atf-c.h | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/src/regress/lib/libc/sys/atf-c.h b/src/regress/lib/libc/sys/atf-c.h deleted file mode 100644 index 6670abac0a..0000000000 --- a/src/regress/lib/libc/sys/atf-c.h +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | /* $OpenBSD: atf-c.h,v 1.5 2022/09/11 20:51:44 mbuhl Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2019 Moritz Buhl <openbsd@moritzbuhl.de> | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | #if !defined(ATF_C_H) | ||
19 | #define ATF_C_H | ||
20 | |||
21 | #include <pwd.h> | ||
22 | #include <stdio.h> | ||
23 | #include <string.h> | ||
24 | #include <unistd.h> | ||
25 | |||
26 | |||
27 | int atf_test(int, int); | ||
28 | void atf_require(int, int, const char *, const char *, const int, char *, ...); | ||
29 | void atf_tc_fail(char *, ...) | ||
30 | __attribute__((__noreturn__, __format__ (printf, 1, 2))); | ||
31 | |||
32 | #define ATF_INSPECT_TEST 1 | ||
33 | #define ATF_RUN_TEST 2 | ||
34 | #define ATF_CLEANUP_TEST 3 | ||
35 | |||
36 | #define ATF_TC_FUNCTIONS(fn) \ | ||
37 | void atf_head_##fn(void); \ | ||
38 | void atf_body_##fn(void); \ | ||
39 | void atf_cleanup_##fn(void); | ||
40 | |||
41 | #define ATF_TC(fn) \ | ||
42 | ATF_TC_FUNCTIONS(fn) \ | ||
43 | void atf_cleanup_##fn(void) { return; } | ||
44 | |||
45 | #define ATF_TC_WITH_CLEANUP(fn) \ | ||
46 | ATF_TC_FUNCTIONS(fn) | ||
47 | |||
48 | #define ATF_TC_HEAD(fn, tc) void atf_head_##fn(void) | ||
49 | #define ATF_TC_BODY(fn, tc) void atf_body_##fn(void) | ||
50 | #define ATF_TC_CLEANUP(fn, tc) void atf_cleanup_##fn(void) | ||
51 | |||
52 | #define ATF_TP_ADD_TCS(tp) int atf_test(int tst, int what) | ||
53 | #define ATF_TP_ADD_TC(tp, fn) tst--; \ | ||
54 | if (tst == 0) { \ | ||
55 | if (what == ATF_INSPECT_TEST) \ | ||
56 | atf_head_##fn(); \ | ||
57 | else if (what == ATF_RUN_TEST) \ | ||
58 | atf_body_##fn(); \ | ||
59 | else if (what == ATF_CLEANUP_TEST) \ | ||
60 | atf_cleanup_##fn(); \ | ||
61 | return 0; \ | ||
62 | } | ||
63 | |||
64 | #define atf_no_error() (-tst) | ||
65 | |||
66 | #define ATF_INSPECT(i) atf_test(i, ATF_INSPECT_TEST) | ||
67 | #define ATF_RUN(i) atf_test(i, ATF_RUN_TEST) | ||
68 | #define ATF_CLEANUP(i) atf_test(i, ATF_CLEANUP_TEST) | ||
69 | |||
70 | #define atf_tc_set_md_var(tc, attr, fmt, ...) \ | ||
71 | if (strcmp(attr, "descr") == 0) \ | ||
72 | printf("DESCR=\"" fmt "\"\n", ##__VA_ARGS__); \ | ||
73 | else if (strcmp(attr, "require.user") == 0) \ | ||
74 | printf("REQ_USER=" fmt "\n", ##__VA_ARGS__); | ||
75 | |||
76 | #define ATF_CHECK ATF_REQUIRE | ||
77 | #define ATF_CHECK_MSG ATF_REQUIRE_MSG | ||
78 | #define ATF_CHECK_EQ ATF_REQUIRE_EQ | ||
79 | #define ATF_CHECK_EQ_MSG ATF_REQUIRE_EQ_MSG | ||
80 | #define ATF_CHECK_ERRNO ATF_REQUIRE_ERRNO | ||
81 | #define ATF_CHECK_STREQ ATF_REQUIRE_STREQ | ||
82 | |||
83 | #define atf_req(exp, err, msg, ...) \ | ||
84 | atf_require(exp, err, #exp, __FILE__, __LINE__, msg, ##__VA_ARGS__) | ||
85 | #define ATF_REQUIRE(exp) atf_req(exp, -1, NULL) | ||
86 | #define ATF_REQUIRE_ERRNO(no, exp) atf_req(exp, no, NULL) | ||
87 | #define ATF_REQUIRE_MSG(exp, fmt, ...) atf_req(exp, -1, fmt, ##__VA_ARGS__) | ||
88 | #define ATF_REQUIRE_EQ(a, b) atf_req((a) == (b), -1, NULL) | ||
89 | #define ATF_REQUIRE_EQ_MSG(a, b, fmt, ...) \ | ||
90 | atf_req((a) == (b), -1, fmt, ##__VA_ARGS__) | ||
91 | #define ATF_REQUIRE_STREQ(x, y) \ | ||
92 | ATF_REQUIRE_MSG(strcmp(x, y) == 0, "%s != %s (%s != %s)", #x, #y, x, y) | ||
93 | |||
94 | #define atf_tc_fail_nonfatal(fmt, ...) atf_tc_fail(fmt, ##__VA_ARGS__) | ||
95 | #define atf_tc_expect_fail(fmt, ...) \ | ||
96 | atf_tc_fail(fmt "\nEXPECTED_FAIL", ##__VA_ARGS__) | ||
97 | #define atf_tc_skip(fmt, ...) \ | ||
98 | atf_tc_fail(fmt "\nSKIPPING", ##__VA_ARGS__) | ||
99 | #define atf_tc_pass() exit(0) | ||
100 | |||
101 | #define atf_tc_get_config_var(a, b) "." | ||
102 | |||
103 | #define atf_utils_fork() fork() | ||
104 | |||
105 | #endif /* !defined(ATF_C_H) */ | ||