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) {
33 tests_verbose = get_verbose(argv, argc); \
34 fprintf(stdout, "- running %s...", __FILE__); \
42 fprintf(stdout, " FAILED (%d)\n", tests_failed); \
44 fprintf(stdout, "OK\n"); \
47 #define __T(text, cond) \
50 fprintf(stderr, "FAILED %s:%d %s\n", __FILE__, __LINE__, text); \
56 #define __T_VERBOSE(...) \
58 if (tests_verbose) { \
59 if (tests_verbose == 1) { \
60 fputc('\n', stderr); \
63 fprintf(stderr, ##__VA_ARGS__); \
67 #endif /* __LIBPERF_INTERNAL_TESTS_H */