Skip to content

Commit 0d2d264

Browse files
anakryikoborkmann
authored andcommitted
selftests/bpf: Fix usdt_400 test case
usdt_400 test case relies on compiler using the same arg spec for usdt_400 USDT. This assumption breaks with Clang (Clang generates different arg specs with varying offsets relative to %rbp), so simplify this further and hard-code the constant which will guarantee that arg spec is the same across all 400 inlinings. Fixes: 630301b ("selftests/bpf: Add basic USDT selftests") Reported-by: Mykola Lysenko <mykolal@fb.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20220513173703.89271-1-andrii@kernel.org
1 parent b2531d4 commit 0d2d264

File tree

1 file changed

+2
-4
lines changed
  • tools/testing/selftests/bpf/prog_tests

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ __weak void trigger_300_usdts(void)
190190

191191
static void __always_inline f400(int x __attribute__((unused)))
192192
{
193-
static int y;
194-
195-
STAP_PROBE1(test, usdt_400, y++);
193+
STAP_PROBE1(test, usdt_400, 400);
196194
}
197195

198196
/* this time we have 400 different USDT call sites, but they have uniform
@@ -299,7 +297,7 @@ static void subtest_multispec_usdt(void)
299297
trigger_400_usdts();
300298

301299
ASSERT_EQ(bss->usdt_100_called, 400, "usdt_400_called");
302-
ASSERT_EQ(bss->usdt_100_sum, 399 * 400 / 2, "usdt_400_sum");
300+
ASSERT_EQ(bss->usdt_100_sum, 400 * 400, "usdt_400_sum");
303301

304302
cleanup:
305303
test_usdt__destroy(skel);

0 commit comments

Comments
 (0)