Skip to content

Commit 1720c42

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
selftests/bpf: fix timer/test_bad_ret subtest on test_progs-cpuv4 flavor
Because test_bad_ret main program is not written in assembly, we don't control instruction indices in timer_cb_ret_bad() subprog. This bites us in timer/test_bad_ret subtest, where we see difference between cpuv4 and other flavors. For now, make __msg() expectations not rely on instruction indices by anchoring them around bpf_get_prandom_u32 call. Once we have regex/glob support for __msg(), this can be expressed a bit more nicely, but for now just mitigating the problem with available means. Fixes: e02dea1 ("selftests/bpf: validate async callback return value check correctness") Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 4af20ab commit 1720c42

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/testing/selftests/bpf/progs/timer_failure.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ __log_level(2)
4747
__flag(BPF_F_TEST_STATE_FREQ)
4848
__failure
4949
/* check that fallthrough code path marks r0 as precise */
50-
__msg("mark_precise: frame0: regs=r0 stack= before 22: (b7) r0 = 0")
50+
__msg("mark_precise: frame0: regs=r0 stack= before")
51+
__msg(": (85) call bpf_get_prandom_u32#7") /* anchor message */
5152
/* check that branch code path marks r0 as precise */
52-
__msg("mark_precise: frame0: regs=r0 stack= before 24: (85) call bpf_get_prandom_u32#7")
53+
__msg("mark_precise: frame0: regs=r0 stack= before ") __msg(": (85) call bpf_get_prandom_u32#7")
5354
__msg("should have been in [0, 0]")
5455
long BPF_PROG2(test_bad_ret, int, a)
5556
{

0 commit comments

Comments
 (0)