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/l4lb_all.c | |
parent | cd9c21d76879a06216597052d3b45c51be977aaa (diff) | |
download | linux-d38835b75f67df16cef65c14aa64796a1832e6b4.tar.bz2 |
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/l4lb_all.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/l4lb_all.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/l4lb_all.c b/tools/testing/selftests/bpf/prog_tests/l4lb_all.c index 20ddca830e68..eaf64595be88 100644 --- a/tools/testing/selftests/bpf/prog_tests/l4lb_all.c +++ b/tools/testing/selftests/bpf/prog_tests/l4lb_all.c @@ -30,10 +30,8 @@ static void test_l4lb(const char *file) u32 *magic = (u32 *)buf; err = bpf_prog_load(file, BPF_PROG_TYPE_SCHED_CLS, &obj, &prog_fd); - if (err) { - error_cnt++; + if (CHECK_FAIL(err)) return; - } map_fd = bpf_find_map(__func__, obj, "vip_map"); if (map_fd < 0) @@ -72,10 +70,9 @@ static void test_l4lb(const char *file) bytes += stats[i].bytes; pkts += stats[i].pkts; } - if (bytes != MAGIC_BYTES * NUM_ITER * 2 || pkts != NUM_ITER * 2) { - error_cnt++; + if (CHECK_FAIL(bytes != MAGIC_BYTES * NUM_ITER * 2 || + pkts != NUM_ITER * 2)) printf("test_l4lb:FAIL:stats %lld %lld\n", bytes, pkts); - } out: bpf_object__close(obj); } |