1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LIBPERF_INTERNAL_TESTS_H
3 #define __LIBPERF_INTERNAL_TESTS_H
8 extern int tests_failed;
9 extern int tests_verbose;
11 static inline int get_verbose(char **argv, int argc)
16 while ((c = getopt(argc, argv, "v")) != -1) {
31 tests_verbose = get_verbose(argv, argc); \
32 fprintf(stdout, "- running %s...", __FILE__); \
40 fprintf(stdout, " FAILED (%d)\n", tests_failed); \
42 fprintf(stdout, "OK\n"); \
45 #define __T(text, cond) \
48 fprintf(stderr, "FAILED %s:%d %s\n", __FILE__, __LINE__, text); \
54 #define __T_VERBOSE(...) \
56 if (tests_verbose) { \
57 if (tests_verbose == 1) { \
58 fputc('\n', stderr); \
61 fprintf(stderr, ##__VA_ARGS__); \
65 #endif /* __LIBPERF_INTERNAL_TESTS_H */