]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
perf test: Skip perf trace tests when running as non-root
authorNamhyung Kim <namhyung@kernel.org>
Tue, 4 Mar 2025 02:28:34 +0000 (18:28 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 5 Mar 2025 17:17:01 +0000 (09:17 -0800)
perf trace requires root because it needs to use tracepoints and BPF.
Skip those test when it's not run as root.

Before:
  $ perf test trace
   15: Parse sched tracepoints fields                                  : Skip (permissions)
   80: perf ftrace tests                                               : Skip
  105: perf trace enum augmentation tests                              : FAILED!
  106: perf trace BTF general tests                                    : FAILED!
  107: perf trace exit race                                            : FAILED!
  118: probe libc's inet_pton & backtrace it with ping                 : Skip
  125: Check Arm CoreSight trace data recording and synthesized samples: Skip
  127: Check Arm SPE trace data recording and synthesized samples      : Skip
  132: Check open filename arg using perf trace + vfs_getname          : FAILED!

After:
  $ perf test trace
   15: Parse sched tracepoints fields                                  : Skip (permissions)
   80: perf ftrace tests                                               : Skip
  105: perf trace enum augmentation tests                              : Skip
  106: perf trace BTF general tests                                    : Skip
  107: perf trace exit race                                            : Skip
  118: probe libc's inet_pton & backtrace it with ping                 : Skip
  125: Check Arm CoreSight trace data recording and synthesized samples: Skip
  127: Check Arm SPE trace data recording and synthesized samples      : Skip
  132: Check open filename arg using perf trace + vfs_getname          : Skip

Tested-by: Thomas Falcon <thomas.falcon@intel.com>
Cc: Howard Chu <howardchu95@gmail.com>
Link: https://lore.kernel.org/r/20250304022837.1877845-4-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/tests/shell/trace+probe_vfs_getname.sh
tools/perf/tests/shell/trace_btf_enum.sh
tools/perf/tests/shell/trace_btf_general.sh
tools/perf/tests/shell/trace_exit_race.sh

index 708a13f0063536115649c096f1aaac03108f458c..60fccb62c5403ee98f5f8abeb7bfdfc784f15155 100755 (executable)
@@ -15,6 +15,7 @@
 
 skip_if_no_perf_probe || exit 2
 skip_if_no_perf_trace || exit 2
+[ "$(id -u)" = 0 ] || exit 2
 
 . "$(dirname $0)"/lib/probe_vfs_getname.sh
 
index 8d1e6bbeac906843ae08cbaadad34fa27c04bcd9..60b3fa254cf6c7bc4323ca47172dfc1e1b3c1ba5 100755 (executable)
@@ -13,6 +13,7 @@ TESTPROG="perf test -w landlock"
 # shellcheck source=lib/probe.sh
 . "$(dirname $0)"/lib/probe.sh
 skip_if_no_perf_trace || exit 2
+[ "$(id -u)" = 0 ] || exit 2
 
 check_vmlinux() {
   echo "Checking if vmlinux exists"
index e9ee727f3433eabaed1e7b43d6c53c547452c3aa..a25d8744695e6fefe8631db61a9caa57f58163aa 100755 (executable)
@@ -76,6 +76,7 @@ trace_config() {
 
 skip_if_no_perf_trace || exit 2
 check_vmlinux || exit 2
+[ "$(id -u)" = 0 ] || exit 2
 
 trace_config
 
index fbb0adc33a8895166d635b28b77c7fece533e493..1e247693e756d4398dd415dd3f1b61a30f580f7d 100755 (executable)
@@ -10,6 +10,7 @@
 . "$(dirname $0)"/lib/probe.sh
 
 skip_if_no_perf_trace || exit 2
+[ "$(id -u)" = 0 ] || exit 2
 
 if [ "$1" = "-v" ]; then
        verbose="1"