diff options
author | Stanislav Fomichev <sdf@google.com> | 2019-08-21 16:44:25 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-08-28 00:35:40 +0200 |
commit | d38835b75f67df16cef65c14aa64796a1832e6b4 (patch) | |
tree | 2ec02d43503dcbcde612f61821e5baa1f8ae25b8 /tools/testing/selftests/bpf/prog_tests/queue_stack_map.c | |
parent | cd9c21d76879a06216597052d3b45c51be977aaa (diff) | |
download | linux-d38835b75f67df16cef65c14aa64796a1832e6b4.tar.gz linux-d38835b75f67df16cef65c14aa64796a1832e6b4.tar.bz2 linux-d38835b75f67df16cef65c14aa64796a1832e6b4.zip |
selftests/bpf: test_progs: remove global fail/success counts
Now that we have a global per-test/per-environment state, there
is no longer need to have global fail/success counters (and there
is no need to save/get the diff before/after the test).
Introduce CHECK_FAIL macro (suggested by Andrii) and covert existing tests
to it. CHECK_FAIL uses new test__fail() to record the failure.
Cc: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/queue_stack_map.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/queue_stack_map.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c b/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c index e60cd5ff1f55..faccc66f4e39 100644 --- a/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c +++ b/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c @@ -27,10 +27,8 @@ static void test_queue_stack_map_by_type(int type) return; err = bpf_prog_load(file, BPF_PROG_TYPE_SCHED_CLS, &obj, &prog_fd); - if (err) { - error_cnt++; + if (CHECK_FAIL(err)) return; - } map_in_fd = bpf_find_map(__func__, obj, "map_in"); if (map_in_fd < 0) @@ -43,10 +41,8 @@ static void test_queue_stack_map_by_type(int type) /* Push 32 elements to the input map */ for (i = 0; i < MAP_SIZE; i++) { err = bpf_map_update_elem(map_in_fd, NULL, &vals[i], 0); - if (err) { - error_cnt++; + if (CHECK_FAIL(err)) goto out; - } } /* The eBPF program pushes iph.saddr in the output map, |