Add unit tests for possible_cpus_array_len
[urcu.git] / tests / utils / tap.h
CommitLineData
ed545d36
MJ
1/*
2 * SPDX-License-Identifier: BSD-2-Clause
1b387491 3 *
ed545d36
MJ
4 * Copyright (C) 2004 Nik Clayton
5 * Copyright (C) 2017 Jérémie Galarneau
1b387491
MJ
6 */
7
153b081a
SM
8#ifdef __cplusplus
9extern "C" {
10#endif
11
1b387491
MJ
12# define ok(e, ...) ((e) ? \
13 _gen_result(1, __func__, __FILE__, __LINE__, \
14 __VA_ARGS__) : \
15 _gen_result(0, __func__, __FILE__, __LINE__, \
16 __VA_ARGS__))
17
18# define ok1(e) ((e) ? \
19 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
20 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
21
95720c6d
MD
22# define pass(...) ok(1, __VA_ARGS__)
23# define fail(...) ok(0, __VA_ARGS__)
1b387491
MJ
24
25# define skip_start(test, n, ...) \
26 do { \
27 if((test)) { \
28 skip(n, __VA_ARGS__); \
29 continue; \
30 }
1b387491
MJ
31
32#define skip_end() } while(0);
33
ed545d36
MJ
34#ifdef __MINGW_PRINTF_FORMAT
35# define TAP_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
36#else
37# define TAP_PRINTF_FORMAT printf
38#endif
39
40__attribute__((format(TAP_PRINTF_FORMAT, 5, 6)))
41unsigned int _gen_result(int, const char *, const char *, unsigned int, const char *, ...);
1b387491
MJ
42
43int plan_no_plan(void);
ed545d36
MJ
44__attribute__((noreturn))
45int plan_skip_all(const char *);
1b387491
MJ
46int plan_tests(unsigned int);
47
ed545d36
MJ
48__attribute__((format(TAP_PRINTF_FORMAT, 1, 2)))
49unsigned int diag(const char *, ...);
50void diag_multiline(const char *);
1b387491 51
ed545d36
MJ
52__attribute__((format(TAP_PRINTF_FORMAT, 2, 3)))
53int skip(unsigned int, const char *, ...);
1b387491 54
ed545d36
MJ
55__attribute__((format(TAP_PRINTF_FORMAT, 1, 2)))
56void todo_start(const char *, ...);
1b387491
MJ
57void todo_end(void);
58
59int exit_status(void);
ad460058
MD
60
61void tap_disable(void);
62
63unsigned int rdiag_start(void);
ed545d36
MJ
64__attribute__((format(TAP_PRINTF_FORMAT, 1, 2)))
65unsigned int rdiag(const char *fmt, ...);
ad460058 66unsigned int rdiag_end(void);
153b081a
SM
67
68#ifdef __cplusplus
69}
70#endif
This page took 0.042562 seconds and 4 git commands to generate.