selftests/bpf: test_progs: remove global fail/success counts
[linux-2.6-microblaze.git] / tools / testing / selftests / bpf / prog_tests / global_data.c
index d011079..c680926 100644 (file)
@@ -7,10 +7,8 @@ static void test_global_data_number(struct bpf_object *obj, __u32 duration)
        uint64_t num;
 
        map_fd = bpf_find_map(__func__, obj, "result_number");
-       if (map_fd < 0) {
-               error_cnt++;
+       if (CHECK_FAIL(map_fd < 0))
                return;
-       }
 
        struct {
                char *name;
@@ -44,10 +42,8 @@ static void test_global_data_string(struct bpf_object *obj, __u32 duration)
        char str[32];
 
        map_fd = bpf_find_map(__func__, obj, "result_string");
-       if (map_fd < 0) {
-               error_cnt++;
+       if (CHECK_FAIL(map_fd < 0))
                return;
-       }
 
        struct {
                char *name;
@@ -81,10 +77,8 @@ static void test_global_data_struct(struct bpf_object *obj, __u32 duration)
        struct foo val;
 
        map_fd = bpf_find_map(__func__, obj, "result_struct");
-       if (map_fd < 0) {
-               error_cnt++;
+       if (CHECK_FAIL(map_fd < 0))
                return;
-       }
 
        struct {
                char *name;
@@ -112,16 +106,12 @@ static void test_global_data_rdonly(struct bpf_object *obj, __u32 duration)
        __u8 *buff;
 
        map = bpf_object__find_map_by_name(obj, "test_glo.rodata");
-       if (!map || !bpf_map__is_internal(map)) {
-               error_cnt++;
+       if (CHECK_FAIL(!map || !bpf_map__is_internal(map)))
                return;
-       }
 
        map_fd = bpf_map__fd(map);
-       if (map_fd < 0) {
-               error_cnt++;
+       if (CHECK_FAIL(map_fd < 0))
                return;
-       }
 
        buff = malloc(bpf_map__def(map)->value_size);
        if (buff)