[PATCH v2 2/5] perf test trace_btf_enum: Skip if permissions are insufficient

From: Ian Rogers
Date: Thu Aug 21 2025 - 12:42:17 EST


Modify test behavior to skip if BPF calls fail with "Operation not
permitted".

Fixes: d66763fed30f ("perf test trace_btf_enum: Add regression test for the BTF augmentation of enums in 'perf trace'")
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/tests/shell/trace_btf_enum.sh | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/tools/perf/tests/shell/trace_btf_enum.sh b/tools/perf/tests/shell/trace_btf_enum.sh
index 572001d75d78..03e9f680a4a6 100755
--- a/tools/perf/tests/shell/trace_btf_enum.sh
+++ b/tools/perf/tests/shell/trace_btf_enum.sh
@@ -23,6 +23,14 @@ check_vmlinux() {
fi
}

+check_permissions() {
+ if perf trace -e $syscall $TESTPROG 2>&1 | grep -q "Operation not permitted"
+ then
+ echo "trace+enum test [Skipped permissions]"
+ err=2
+ fi
+}
+
trace_landlock() {
echo "Tracing syscall ${syscall}"

@@ -56,6 +64,9 @@ trace_non_syscall() {
}

check_vmlinux
+if [ $err = 0 ]; then
+ check_permissions
+fi

if [ $err = 0 ]; then
trace_landlock
--
2.51.0.rc1.193.gad69d77794-goog