diff options
| author | Stanislav Fomichev <[email protected]> | 2019-08-21 23:44:25 +0000 |
|---|---|---|
| committer | Daniel Borkmann <[email protected]> | 2019-08-27 22:35:40 +0000 |
| commit | d38835b75f67df16cef65c14aa64796a1832e6b4 (patch) | |
| tree | 2ec02d43503dcbcde612f61821e5baa1f8ae25b8 /tools/testing/selftests/bpf/prog_tests/spinlock.c | |
| parent | selftests/bpf: test_progs: test__skip (diff) | |
| download | kernel-d38835b75f67df16cef65c14aa64796a1832e6b4.tar.gz kernel-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 <[email protected]>
Signed-off-by: Stanislav Fomichev <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/spinlock.c')
| -rw-r--r-- | tools/testing/selftests/bpf/prog_tests/spinlock.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/spinlock.c b/tools/testing/selftests/bpf/prog_tests/spinlock.c index 114ebe6a438e..d71fb3dda376 100644 --- a/tools/testing/selftests/bpf/prog_tests/spinlock.c +++ b/tools/testing/selftests/bpf/prog_tests/spinlock.c @@ -11,7 +11,7 @@ void test_spinlock(void) void *ret; err = bpf_prog_load(file, BPF_PROG_TYPE_CGROUP_SKB, &obj, &prog_fd); - if (err) { + if (CHECK_FAIL(err)) { printf("test_spin_lock:bpf_prog_load errno %d\n", errno); goto close_prog; } @@ -21,9 +21,7 @@ void test_spinlock(void) for (i = 0; i < 4; i++) assert(pthread_join(thread_id[i], &ret) == 0 && ret == (void *)&prog_fd); - goto close_prog_noerr; + close_prog: - error_cnt++; -close_prog_noerr: bpf_object__close(obj); } |
