Leon Hwang
fbdd61c94b
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
456 timer:SKIP
457/1 timer_crash/array:SKIP
457/2 timer_crash/hash:SKIP
457 timer_crash:SKIP
458 timer_lockup:SKIP
459 timer_mim:SKIP
Summary: 5/0 PASSED, 6 SKIPPED, 0 FAILED
Signed-off-by: Leon Hwang <leon.hwang@linux.dev >
Link: https://lore.kernel.org/r/20250910125740.52172-3-leon.hwang@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2025-09-10 12:34:09 -07:00
Andrii Nakryiko
b2531d4bdc
selftests/bpf: Convert some selftests to high-level BPF map APIs
...
Convert a bunch of selftests to using newly added high-level BPF map
APIs.
This change exposed that map_kptr selftests allocated too big buffer,
which is fixed in this patch as well.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net >
Link: https://lore.kernel.org/bpf/20220512220713.2617964-2-andrii@kernel.org
2022-05-13 15:15:21 +02:00
Delyan Kratunov
04fcb5f9a1
selftests/bpf: Migrate from bpf_prog_test_run
...
bpf_prog_test_run is being deprecated in favor of the OPTS-based
bpf_prog_test_run_opts.
We end up unable to use CHECK in most cases, so replace usages with
ASSERT_* calls.
Signed-off-by: Delyan Kratunov <delyank@fb.com >
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Link: https://lore.kernel.org/bpf/20220202235423.1097270-2-delyank@fb.com
2022-02-02 22:31:18 -08:00
Yucong Sun
d3f7b1664d
selfetest/bpf: Make some tests serial
...
Change tests that often fails in parallel execution mode to serial.
Signed-off-by: Yucong Sun <sunyucong@gmail.com >
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Link: https://lore.kernel.org/bpf/20211006185619.364369-15-fallentree@fb.com
2021-10-08 15:17:00 -07:00
Yucong Sun
a6258837c8
selftests/bpf: Reduce flakyness in timer_mim
...
This patch extends wait time in timer_mim. As observed in slow CI environment,
it is possible to have interrupt/preemption long enough to cause the test to
fail, almost 1 failure in 5 runs.
Signed-off-by: Yucong Sun <fallentree@fb.com >
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Link: https://lore.kernel.org/bpf/20210823213629.3519641-1-fallentree@fb.com
2021-08-23 18:01:47 -07:00
Alexei Starovoitov
61f71e746c
selftests/bpf: Add a test with bpf_timer in inner map.
...
Check that map-in-map supports bpf timers.
Check that indirect "recursion" of timer callbacks works:
timer_cb1() { bpf_timer_set_callback(timer_cb2); }
timer_cb2() { bpf_timer_set_callback(timer_cb1); }
Check that
bpf_map_release
htab_free_prealloced_timers
bpf_timer_cancel_and_free
hrtimer_cancel
works while timer cb is running.
"while true; do ./test_progs -t timer_mim; done"
is a great stress test. It caught missing timer cancel in htab->extra_elems.
timer_mim_reject.c is a negative test that checks
that timer<->map mismatch is prevented.
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net >
Acked-by: Andrii Nakryiko <andrii@kernel.org >
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com >
Link: https://lore.kernel.org/bpf/20210715005417.78572-12-alexei.starovoitov@gmail.com
2021-07-15 22:31:11 +02:00