Merge tag 'ntb-5.11' of git://github.com/jonmason/ntb
[linux/fpc-iii.git] / tools / lib / perf / include / internal / tests.h
blob2093e8868a674487936f692bdeee375ecc7afe12
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LIBPERF_INTERNAL_TESTS_H
3 #define __LIBPERF_INTERNAL_TESTS_H
5 #include <stdio.h>
7 int tests_failed;
9 #define __T_START \
10 do { \
11 fprintf(stdout, "- running %s...", __FILE__); \
12 fflush(NULL); \
13 tests_failed = 0; \
14 } while (0)
16 #define __T_END \
17 do { \
18 if (tests_failed) \
19 fprintf(stdout, " FAILED (%d)\n", tests_failed); \
20 else \
21 fprintf(stdout, "OK\n"); \
22 } while (0)
24 #define __T(text, cond) \
25 do { \
26 if (!(cond)) { \
27 fprintf(stderr, "FAILED %s:%d %s\n", __FILE__, __LINE__, text); \
28 tests_failed++; \
29 return -1; \
30 } \
31 } while (0)
33 #endif /* __LIBPERF_INTERNAL_TESTS_H */