mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
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>
37 lines
732 B
C
37 lines
732 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <test_progs.h>
|
|
#include "timer_crash.skel.h"
|
|
|
|
enum {
|
|
MODE_ARRAY,
|
|
MODE_HASH,
|
|
};
|
|
|
|
static void test_timer_crash_mode(int mode)
|
|
{
|
|
struct timer_crash *skel;
|
|
|
|
skel = timer_crash__open_and_load();
|
|
if (!skel && errno == EOPNOTSUPP) {
|
|
test__skip();
|
|
return;
|
|
}
|
|
if (!ASSERT_OK_PTR(skel, "timer_crash__open_and_load"))
|
|
return;
|
|
skel->bss->pid = getpid();
|
|
skel->bss->crash_map = mode;
|
|
if (!ASSERT_OK(timer_crash__attach(skel), "timer_crash__attach"))
|
|
goto end;
|
|
usleep(1);
|
|
end:
|
|
timer_crash__destroy(skel);
|
|
}
|
|
|
|
void test_timer_crash(void)
|
|
{
|
|
if (test__start_subtest("array"))
|
|
test_timer_crash_mode(MODE_ARRAY);
|
|
if (test__start_subtest("hash"))
|
|
test_timer_crash_mode(MODE_HASH);
|
|
}
|