Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test: Restrict uniquifying test to machines with 'uncore_imc'

The test would fail if target machine does not have 'uncore_imc'
devices.

Since event uniquifying behavior is similar among different
architectures, we are restricting the test to only run on machines with
`uncore_imc` devices.

Suggested-by: Ian Rogers <irogers@google.com>
Signed-off-by: Chun-Tse Shao <ctshao@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250521224513.1104129-1-ctshao@google.com
[ Skip the test, i.e. return 2, instead of returning 0 as if the test had succeed ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Chun-Tse Shao and committed by
Arnaldo Carvalho de Melo
070b3153 44a5ab7a

+10 -2
+10 -2
tools/perf/tests/shell/stat+event_uniquifying.sh
··· 9 9 err=0 10 10 11 11 test_event_uniquifying() { 12 - # We use `clockticks` to verify the uniquify behavior. 12 + # We use `clockticks` in `uncore_imc` to verify the uniquify behavior. 13 + pmu="uncore_imc" 13 14 event="clockticks" 14 15 15 16 # If the `-A` option is added, the event should be uniquified. ··· 44 43 echo "stat event uniquifying test" 45 44 uniquified_event_array=() 46 45 46 + # Skip if the machine does not have `uncore_imc` device. 47 + if ! ${perf_tool} list pmu | grep -q ${pmu}; then 48 + echo "Target does not support PMU ${pmu} [Skipped]" 49 + err=2 50 + return 51 + fi 52 + 47 53 # Check how many uniquified events. 48 54 while IFS= read -r line; do 49 55 uniquified_event=$(echo "$line" | awk '{print $1}') 50 56 uniquified_event_array+=("${uniquified_event}") 51 - done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]") 57 + done < <(${perf_tool} list -v ${event} | grep ${pmu}) 52 58 53 59 perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true" 54 60 $perf_command