diff options
| author | Andrii Nakryiko <[email protected]> | 2021-05-25 03:59:32 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2021-05-26 00:32:35 +0000 |
| commit | bad2e478af3b4df9fd84b4db7779ea91bd618c16 (patch) | |
| tree | b2739a3cb481bc0f9ea4745ba21393e02924a32e /tools/testing/selftests/bpf/prog_tests/stacktrace_map.c | |
| parent | libbpf: Add libbpf_set_strict_mode() API to turn on libbpf 1.0 behaviors (diff) | |
| download | kernel-bad2e478af3b4df9fd84b4db7779ea91bd618c16.tar.gz kernel-bad2e478af3b4df9fd84b4db7779ea91bd618c16.zip | |
selftests/bpf: Turn on libbpf 1.0 mode and fix all IS_ERR checks
Turn ony libbpf 1.0 mode. Fix all the explicit IS_ERR checks that now will be
broken because libbpf returns NULL on error (and sets errno). Fix
ASSERT_OK_PTR and ASSERT_ERR_PTR to work for both old mode and new modes and
use them throughout selftests. This is trivial to do by using
libbpf_get_error() API that all libbpf users are supposed to use, instead of
IS_ERR checks.
A bunch of checks also did explicit -1 comparison for various fd-returning
APIs. Such checks are replaced with >= 0 or < 0 cases.
There were also few misuses of bpf_object__find_map_by_name() in test_maps.
Those are fixed in this patch as well.
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Acked-by: John Fastabend <[email protected]>
Acked-by: Toke Høiland-Jørgensen <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/stacktrace_map.c')
| -rw-r--r-- | tools/testing/selftests/bpf/prog_tests/stacktrace_map.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/stacktrace_map.c b/tools/testing/selftests/bpf/prog_tests/stacktrace_map.c index 37269d23df93..04b476bd62b9 100644 --- a/tools/testing/selftests/bpf/prog_tests/stacktrace_map.c +++ b/tools/testing/selftests/bpf/prog_tests/stacktrace_map.c @@ -21,7 +21,7 @@ void test_stacktrace_map(void) goto close_prog; link = bpf_program__attach_tracepoint(prog, "sched", "sched_switch"); - if (CHECK(IS_ERR(link), "attach_tp", "err %ld\n", PTR_ERR(link))) + if (!ASSERT_OK_PTR(link, "attach_tp")) goto close_prog; /* find map fds */ |
