Add udst_multispec_fail subtest. For arm64/clang20 build, the BPF_USDT_MAX_SPEC_CNT is set to 2. Otherwise, the BPF_USDT_MAX_SPEC_CNT remains the default value 256. This resolved the previous test failure. Signed-off-by: Yonghong Song <yonghong.song@xxxxxxxxx> --- tools/testing/selftests/bpf/prog_tests/usdt.c | 7 ++++--- .../selftests/bpf/progs/test_usdt_multispec_fail.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/test_usdt_multispec_fail.c diff --git a/tools/testing/selftests/bpf/prog_tests/usdt.c b/tools/testing/selftests/bpf/prog_tests/usdt.c index dc29ef94312a..cc7f38b03a96 100644 --- a/tools/testing/selftests/bpf/prog_tests/usdt.c +++ b/tools/testing/selftests/bpf/prog_tests/usdt.c @@ -7,6 +7,7 @@ #include "test_usdt.skel.h" #include "test_urandom_usdt.skel.h" +#include "test_usdt_multispec_fail.skel.h" int lets_test_this(int); @@ -305,10 +306,10 @@ static void subtest_multispec_usdt(void) static void subtest_multispec_fail_usdt(void) { LIBBPF_OPTS(bpf_usdt_opts, opts); - struct test_usdt *skel; + struct test_usdt_multispec_fail *skel; int err; - skel = test_usdt__open_and_load(); + skel = test_usdt_multispec_fail__open_and_load(); if (!ASSERT_OK_PTR(skel, "skel_open")) return; @@ -322,7 +323,7 @@ static void subtest_multispec_fail_usdt(void) ASSERT_EQ(err, -E2BIG, "usdt_300_attach_err"); cleanup: - test_usdt__destroy(skel); + test_usdt_multispec_fail__destroy(skel); } static FILE *urand_spawn(int *pid) diff --git a/tools/testing/selftests/bpf/progs/test_usdt_multispec_fail.c b/tools/testing/selftests/bpf/progs/test_usdt_multispec_fail.c new file mode 100644 index 000000000000..4cca3d8d45fb --- /dev/null +++ b/tools/testing/selftests/bpf/progs/test_usdt_multispec_fail.c @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ + +#if defined(__clang__) && defined(__TARGET_ARCH_arm64) +#define BPF_USDT_MAX_SPEC_CNT 2 +#endif + +int my_pid; + +#include "test_usdt_multispec.inc.h" -- 2.47.1