Fix: syscall event rule: emission sites not compared in is_equal
[lttng-tools.git] / tests / utils / tap / tap.h
CommitLineData
9f4a25d3 1/*
9d16b343
MJ
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
9f4a25d3
SM
4 * Copyright (C) 2004 Nik Clayton
5 * Copyright (C) 2017 Jérémie Galarneau
86a96e6c
CB
6 */
7
7966af57
SM
8#ifdef __cplusplus
9extern "C" {
10#endif
11
86a96e6c
CB
12/* '## __VA_ARGS__' is a gcc'ism. C99 doesn't allow the token pasting
13 and requires the caller to add the final comma if they've ommitted
14 the optional arguments */
15#ifdef __GNUC__
28f23191
JG
16#define ok(e, test, ...) \
17 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, test, ##__VA_ARGS__) : \
18 _gen_result(0, __func__, __FILE__, __LINE__, test, ##__VA_ARGS__))
19
20#define ok1(e) \
21 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
22 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
23
24#define pass(test, ...) ok(1, test, ##__VA_ARGS__)
25#define fail(test, ...) ok(0, test, ##__VA_ARGS__)
26
27#define skip_start(test, n, fmt, ...) \
28 do { \
29 if ((test)) { \
30 skip(n, fmt, ##__VA_ARGS__); \
31 continue; \
86a96e6c 32 }
f3af9f34 33#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* __GNUC__ */
28f23191
JG
34#define ok(e, ...) \
35 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, __VA_ARGS__) : \
36 _gen_result(0, __func__, __FILE__, __LINE__, __VA_ARGS__))
37
38#define ok1(e) \
39 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
40 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
41
42#define pass(...) ok(1, __VA_ARGS__)
43#define fail(...) ok(0, __VA_ARGS__)
44
45#define skip_start(test, n, ...) \
46 do { \
47 if ((test)) { \
48 skip(n, __VA_ARGS__); \
49 continue; \
86a96e6c
CB
50 }
51#else /* __STDC_VERSION__ */
28f23191 52#error "Needs gcc or C99 compiler for variadic macros."
86a96e6c
CB
53#endif /* __STDC_VERSION__ */
54
28f23191
JG
55#define skip_end() \
56 } \
57 while (0) \
58 ;
86a96e6c 59
9f4a25d3 60#ifdef __MINGW_PRINTF_FORMAT
28f23191 61#define TAP_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
9f4a25d3 62#else
28f23191 63#define TAP_PRINTF_FORMAT printf
9f4a25d3
SM
64#endif
65
28f23191
JG
66__attribute__((format(TAP_PRINTF_FORMAT, 5, 6))) unsigned int
67_gen_result(int, const char *, const char *, unsigned int, const char *, ...);
86a96e6c 68
2a69bf14
KS
69void _output_test_time(void);
70
86a96e6c 71int plan_no_plan(void);
28f23191 72__attribute__((noreturn)) int plan_skip_all(const char *);
86a96e6c
CB
73int plan_tests(unsigned int);
74
28f23191 75__attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) unsigned int diag(const char *, ...);
9f4a25d3 76void diag_multiline(const char *);
86a96e6c 77
28f23191 78__attribute__((format(TAP_PRINTF_FORMAT, 2, 3))) int skip(unsigned int, const char *, ...);
86a96e6c 79
28f23191 80__attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) void todo_start(const char *, ...);
86a96e6c
CB
81void todo_end(void);
82
83int exit_status(void);
7966af57
SM
84
85#ifdef __cplusplus
86}
87#endif
This page took 0.061119 seconds and 5 git commands to generate.