diff options
| author | Ian Rogers <irogers@google.com> | 2025-06-04 10:45:39 -0700 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2025-06-09 11:18:18 -0700 |
| commit | c54e2f82721aadd59d2a354ae2b5cc32d32047d9 (patch) | |
| tree | 3129f744f55a7971aa7cf6da10ce7b53b60cfd7b /tools/perf/tests/shell | |
| parent | perf record: Switch user option to use BPF filter (diff) | |
| download | linux-c54e2f82721aadd59d2a354ae2b5cc32d32047d9.tar.gz linux-c54e2f82721aadd59d2a354ae2b5cc32d32047d9.zip | |
perf tests record: Add basic uid filtering test
Based on the system-wide test with changes around how failure is
handled as BPF permissions are a bigger issue than perf event
paranoia.
Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250604174545.2853620-6-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/tests/shell')
| -rwxr-xr-x | tools/perf/tests/shell/record.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index 587f62e34414..2022a4f739be 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -231,6 +231,31 @@ test_cgroup() { echo "Cgroup sampling test [Success]" } +test_uid() { + echo "Uid sampling test" + if ! perf record -aB --synth=no --uid "$(id -u)" -o "${perfdata}" ${testprog} \ + > "${script_output}" 2>&1 + then + if grep -q "libbpf.*EPERM" "${script_output}" + then + echo "Uid sampling [Skipped permissions]" + return + else + echo "Uid sampling [Failed to record]" + err=1 + # cat "${script_output}" + return + fi + fi + if ! perf report -i "${perfdata}" -q | grep -q "${testsym}" + then + echo "Uid sampling [Failed missing output]" + err=1 + return + fi + echo "Uid sampling test [Success]" +} + test_leader_sampling() { echo "Basic leader sampling test" if ! perf record -o "${perfdata}" -e "{cycles,cycles}:Su" -- \ @@ -345,6 +370,7 @@ test_system_wide test_workload test_branch_counter test_cgroup +test_uid test_leader_sampling test_topdown_leader_sampling test_precise_max |
