Skip to content

Commit 18dbfd8

Browse files
AsphalttKernel Patches Daemon
authored andcommitted
selftests/bpf: Skip timer cases when bpf_timer is not supported
When enable CONFIG_PREEMPT_RT, verifier will reject bpf_timer with returning -EOPNOTSUPP. Therefore, skip test cases when errno is EOPNOTSUPP. cd tools/testing/selftests/bpf ./test_progs -t timer 125 free_timer:SKIP 459 timer:SKIP 460/1 timer_crash/array:SKIP 460/2 timer_crash/hash:SKIP 460 timer_crash:SKIP 461 timer_interrupt:SKIP 462 timer_lockup:SKIP 463 timer_mim:SKIP Summary: 6/0 PASSED, 7 SKIPPED, 0 FAILED Signed-off-by: Leon Hwang <[email protected]>
1 parent c1ffe5f commit 18dbfd8

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

tools/testing/selftests/bpf/prog_tests/free_timer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ void test_free_timer(void)
124124
int err;
125125

126126
skel = free_timer__open_and_load();
127+
if (!skel && errno == EOPNOTSUPP) {
128+
test__skip();
129+
return;
130+
}
127131
if (!ASSERT_OK_PTR(skel, "open_load"))
128132
return;
129133

tools/testing/selftests/bpf/prog_tests/timer.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ void serial_test_timer(void)
8787
int err;
8888

8989
timer_skel = timer__open_and_load();
90+
if (!timer_skel && errno == EOPNOTSUPP) {
91+
test__skip();
92+
return;
93+
}
9094
if (!ASSERT_OK_PTR(timer_skel, "timer_skel_load"))
9195
return;
9296

@@ -104,6 +108,10 @@ void test_timer_interrupt(void)
104108
LIBBPF_OPTS(bpf_test_run_opts, opts);
105109

106110
skel = timer_interrupt__open_and_load();
111+
if (!skel && errno == EOPNOTSUPP) {
112+
test__skip();
113+
return;
114+
}
107115
if (!ASSERT_OK_PTR(skel, "timer_interrupt__open_and_load"))
108116
return;
109117

tools/testing/selftests/bpf/prog_tests/timer_crash.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ static void test_timer_crash_mode(int mode)
1212
struct timer_crash *skel;
1313

1414
skel = timer_crash__open_and_load();
15+
if (!skel && errno == EOPNOTSUPP) {
16+
test__skip();
17+
return;
18+
}
1519
if (!ASSERT_OK_PTR(skel, "timer_crash__open_and_load"))
1620
return;
1721
skel->bss->pid = getpid();

tools/testing/selftests/bpf/prog_tests/timer_lockup.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ void test_timer_lockup(void)
5959
}
6060

6161
skel = timer_lockup__open_and_load();
62+
if (!skel && errno == EOPNOTSUPP) {
63+
test__skip();
64+
return;
65+
}
6266
if (!ASSERT_OK_PTR(skel, "timer_lockup__open_and_load"))
6367
return;
6468

tools/testing/selftests/bpf/prog_tests/timer_mim.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ void serial_test_timer_mim(void)
6565
goto cleanup;
6666

6767
timer_skel = timer_mim__open_and_load();
68+
if (!timer_skel && errno == EOPNOTSUPP) {
69+
test__skip();
70+
return;
71+
}
6872
if (!ASSERT_OK_PTR(timer_skel, "timer_skel_load"))
6973
goto cleanup;
7074

0 commit comments

Comments
 (0)