perf test trace_btf_enum: Skip if permissions are insufficient

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

Fixes: d66763fed3 ("perf test trace_btf_enum: Add regression test for the BTF augmentation of enums in 'perf trace'")
Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Blake Jones <blakejones@google.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jan Polensky <japo@linux.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Li Huafei <lihuafei1@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Nam Cao <namcao@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steinar H. Gunderson <sesse@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20250821163820.1132977-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2025-08-21 09:38:16 -07:00 committed by Arnaldo Carvalho de Melo
parent 78d853512d
commit 4bd5bd8dbd

View File

@ -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