From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
Clark Williams <williams@redhat.com>,
dwarves@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH v1 1/1] tests: Skip bpftool checks when it cannot parse the BTF
Date: Sat, 28 Nov 2026 23:11:28 -0300 [thread overview]
Message-ID: <20261129021128.6449-1-acme@kernel.org> (raw)
From: Arnaldo Carvalho de Melo <acme@redhat.com>
bpftool older than 7.8 cannot load BTF carrying inline locations or the
kinds enabled by --btf_gen_all: it fails with "Invalid argument" and
dumps nothing, so btf_inline.sh reports missing LOCSEC call sites and
btf_vmlinux.sh reports btf_gen_all producing zero types, even though
pahole encoded the BTF.
Skip the check when the dump fails or is empty, as the basic vmlinux
dump already does. When bpftool parses the BTF, a missing LOCSEC or a
lower btf_gen_all count still fails the test.
Verified in the fedora:45 image (bpftool 7.7.0): both tests skip. In
the fedora:46 image (bpftool 7.8.1): both pass, with 1529341
btf_gen_all lines against 388493 basic.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tests/btf_inline.sh | 8 ++++++--
tests/btf_vmlinux.sh | 4 ++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/tests/btf_inline.sh b/tests/btf_inline.sh
index 007fc4872a99b2c6..51ea199e0a467c9f 100755
--- a/tests/btf_inline.sh
+++ b/tests/btf_inline.sh
@@ -128,8 +128,12 @@ if ! inline_sites=$(pfunct --inline_sites --elf "$obj" "$btf" 2>/dev/null) ||
fi
if command -v bpftool >/dev/null 2>&1; then
- locsec_vlen=$(bpftool btf dump file "$btf" format raw 2>/dev/null |
- sed -n 's/.*LOCSEC .*vlen=\([0-9][0-9]*\).*/\1/p')
+ if ! dump=$(bpftool btf dump file "$btf" format raw 2>/dev/null) ||
+ [ -z "$dump" ]; then
+ info_log "skip: bpftool cannot parse inline BTF (too old or missing features)"
+ test_skip
+ fi
+ locsec_vlen=$(sed -n 's/.*LOCSEC .*vlen=\([0-9][0-9]*\).*/\1/p' <<<"$dump")
if [[ -z "$locsec_vlen" || "$locsec_vlen" -lt 2 ]]; then
error_log "multiple inline call sites are missing from LOCSEC"
test_fail
diff --git a/tests/btf_vmlinux.sh b/tests/btf_vmlinux.sh
index e3c00502bdfeef32..dd135f7e1a460698 100755
--- a/tests/btf_vmlinux.sh
+++ b/tests/btf_vmlinux.sh
@@ -116,6 +116,10 @@ fi
# btf_gen_all should produce at least as many types as the basic encode
basic_types=$(bpftool btf dump file "$btf_basic" 2>/dev/null | wc -l)
all_types=$(bpftool btf dump file "$btf_all" 2>/dev/null | wc -l)
+if [ "$all_types" -eq 0 ]; then
+ info_log "skip: bpftool cannot parse btf_gen_all BTF (too old or missing features)"
+ test_skip
+fi
if [ "$all_types" -lt "$basic_types" ]; then
error_log "FAIL: btf_gen_all produced fewer types ($all_types) than basic ($basic_types)"
test_fail
--
2.56.0
next reply other threads:[~2026-11-29 2:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 2:11 Arnaldo Carvalho de Melo [this message]
2026-11-30 18:45 ` [PATCH v1 1/1] tests: Skip bpftool checks when it cannot parse the BTF Alan Maguire
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261129021128.6449-1-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=alan.maguire@oracle.com \
--cc=dwarves@vger.kernel.org \
--cc=jolsa@kernel.org \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.