Skip to content

Commit ef4e04e

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
selftests/bpf: Skip ENOTSUPP in ASSERT_GE
There are still some "ENOTSUPP" (-524) errors left when running BPF selftests on a Loongarch platform since ASSERT_GE() are used there to check the return values, not ASSERT_OK(): ''' test_bpf_cookie:PASS:skel_open 0 nsec torvalds#17/1 bpf_cookie/kprobe:OK torvalds#17/2 bpf_cookie/multi_kprobe_link_api:OK torvalds#17/3 bpf_cookie/multi_kprobe_attach_api:OK torvalds#17/4 bpf_cookie/uprobe:OK torvalds#17/5 bpf_cookie/multi_uprobe_attach_api:OK torvalds#17/6 bpf_cookie/tracepoint:OK torvalds#17/7 bpf_cookie/perf_event:OK tracing_subtest:FAIL:fentry.link_create unexpected fentry.link_create: \ actual -524 < expected 0 torvalds#17/8 bpf_cookie/trampoline:FAIL lsm_subtest:FAIL:lsm.link_create unexpected lsm.link_create: \ actual -524 < expected 0 torvalds#17/9 bpf_cookie/lsm:FAIL torvalds#17/10 bpf_cookie/tp_btf:OK torvalds#17/11 bpf_cookie/raw_tp:OK torvalds#17 bpf_cookie:FAIL ... ... test_module_fentry_shadow:PASS:load_vmlinux_btf 0 nsec test_module_fentry_shadow:PASS:get_bpf_testmod_btf_fd 0 nsec test_module_fentry_shadow:PASS:btf_get_from_fd 0 nsec test_module_fentry_shadow:PASS:btf_find_by_name 0 nsec test_module_fentry_shadow:PASS:btf_find_by_name 0 nsec test_module_fentry_shadow:PASS:bpf_prog_load 0 nsec test_module_fentry_shadow:FAIL:bpf_link_create unexpected \ bpf_link_create: actual -524 < expected 0 torvalds#168 module_fentry_shadow:FAIL ''' Just like in ASSERT_OK(), this patch skips ENOTSUPP (524) and ENOTSUP (95) in ASSERT_GT() too. With this change, the new output of these selftests look like: ''' torvalds#17/1 bpf_cookie/kprobe:OK torvalds#17/2 bpf_cookie/multi_kprobe_link_api:OK torvalds#17/3 bpf_cookie/multi_kprobe_attach_api:OK torvalds#17/4 bpf_cookie/uprobe:OK torvalds#17/5 bpf_cookie/multi_uprobe_attach_api:OK torvalds#17/6 bpf_cookie/tracepoint:OK torvalds#17/7 bpf_cookie/perf_event:OK torvalds#17/8 bpf_cookie/trampoline:SKIP torvalds#17/9 bpf_cookie/lsm:SKIP torvalds#17/10 bpf_cookie/tp_btf:SKIP torvalds#17/11 bpf_cookie/raw_tp:SKIP torvalds#17 bpf_cookie:OK (SKIP: 4/11) ... ... torvalds#168 module_fentry_shadow:SKIP ''' Signed-off-by: Geliang Tang <[email protected]>
1 parent a0325a2 commit ef4e04e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tools/testing/selftests/bpf/test_progs.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,13 @@ int test__join_cgroup(const char *path);
294294
typeof(actual) ___act = (actual); \
295295
typeof(expected) ___exp = (expected); \
296296
bool ___ok = ___act >= ___exp; \
297-
CHECK(!___ok, (name), \
298-
"unexpected %s: actual %lld < expected %lld\n", \
299-
(name), (long long)(___act), (long long)(___exp)); \
297+
if (___act == -ENOTSUPP || ___act == -ENOTSUP || \
298+
errno == ENOTSUPP || errno == ENOTSUP) \
299+
test__skip(); \
300+
else \
301+
CHECK(!___ok, (name), \
302+
"unexpected %s: actual %lld < expected %lld\n", \
303+
(name), (long long)(___act), (long long)(___exp));\
300304
___ok; \
301305
})
302306

0 commit comments

Comments
 (0)