perf test: Skip sched stats test for !root

Running perf sched stats requires root and it fails to open the
schedstat file for regular users.  Let's skip the test.

  $ perf sched stats true
  Failed to open /proc/sys/kernel/sched_schedstats

Reviewed-by: Ian Rogers <irogers@google.com>
Tested-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Namhyung Kim
2026-04-04 22:16:44 -07:00
parent c9ef786c09
commit dc647eb009

View File

@@ -4,6 +4,11 @@
set -e
if [ "$(id -u)" != 0 ]; then
echo "[Skip] No root permission"
exit 2
fi
perfdata=$(mktemp /tmp/__perf_test_sched_stats.perf.data.XXXXX)
perfdata2=$(mktemp /tmp/__perf_test_sched_stats.perf.data.XXXXX)