selftests/bpf: test_progs: remove global fail/success counts
[linux-2.6-microblaze.git] / tools / testing / selftests / bpf / test_progs.h
index 9defd35..33da849 100644 (file)
@@ -38,8 +38,6 @@ typedef __u16 __sum16;
 #include "trace_helpers.h"
 #include "flow_dissector_load.h"
 
-struct prog_test_def;
-
 struct test_selector {
        const char *name;
        bool *num_set;
@@ -67,13 +65,12 @@ struct test_env {
        int skip_cnt; /* skipped tests */
 };
 
-extern int error_cnt;
-extern int pass_cnt;
 extern struct test_env env;
 
 extern void test__force_log();
 extern bool test__start_subtest(const char *name);
 extern void test__skip(void);
+extern void test__fail(void);
 
 #define MAGIC_BYTES 123
 
@@ -96,17 +93,25 @@ extern struct ipv6_packet pkt_v6;
 #define _CHECK(condition, tag, duration, format...) ({                 \
        int __ret = !!(condition);                                      \
        if (__ret) {                                                    \
-               error_cnt++;                                            \
+               test__fail();                                           \
                printf("%s:FAIL:%s ", __func__, tag);                   \
                printf(format);                                         \
        } else {                                                        \
-               pass_cnt++;                                             \
                printf("%s:PASS:%s %d nsec\n",                          \
                       __func__, tag, duration);                        \
        }                                                               \
        __ret;                                                          \
 })
 
+#define CHECK_FAIL(condition) ({                                       \
+       int __ret = !!(condition);                                      \
+       if (__ret) {                                                    \
+               test__fail();                                           \
+               printf("%s:FAIL:%d ", __func__, __LINE__);              \
+       }                                                               \
+       __ret;                                                          \
+})
+
 #define CHECK(condition, tag, format...) \
        _CHECK(condition, tag, duration, format)
 #define CHECK_ATTR(condition, tag, format...) \