Skip to contentSkip to conversation

perf test: Skip stat uniquifying test if unavailable

PATCH In review Thomas Richter 2 participants 2 messages Jun 10, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf test: Skip stat uniquifying test if unavailable

Commit cb422594d6206 ("perf test: Add stat uniquifying test") introduced a new test case which uses an event named clockticks which is exported as sysfs file .../uncore_imc_0/clockticks. This file does not exist on s390 and causes the test case to always fail.

Check for the existence of file clockticks and skip this test if the event does not exist.

Output before:
# perf test 87
87: perf stat events uniquifying : FAILED!

 # ./perf stat -e clockticks -A
   event syntax error: 'clockticks'
                        \___ Bad event name
   ...
 #

Output after:
# perf test 87
87: perf stat events uniquifying : Skip
#

Fixes cb422594d6206 ("perf test: Add stat uniquifying test")
Cc Chun-Tse Shao <[email protected]>
---
 tools/perf/tests/shell/stat+event_uniquifying.sh | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/tests/shell/stat+event_uniquifying.sh +5 -0
index 5ec35c52b7d9..485ee6e8f574 100755
@@ -49,6 +49,11 @@ test_event_uniquifying() {
     uniquified_event_array+=("${uniquified_event}")
   done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]")
 
+  if [ -z "$uniquified_event" ]
+  then
+    err=2
+    return
+  fi
   perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true"
   $perf_command
 
Signature · 1 line
2.49.0
#1 lore raw

Hi Thomas,

Thanks for the fix. Arnaldo also had a fix and should fix this issue.

https://lore.kernel.org/all/aEHugAPinlWLuTAS@x1/

Thanks,
CT

Quoted 51 lines · Thomas Richter

Commit cb422594d6206 ("perf test: Add stat uniquifying test") introduced a new test case which uses an event named clockticks which is exported as sysfs file .../uncore_imc_0/clockticks. This file does not exist on s390 and causes the test case to always fail.

Check for the existence of file clockticks and skip this test if the event does not exist.

Output before:
# perf test 87
87: perf stat events uniquifying : FAILED!

 # ./perf stat -e clockticks -A
   event syntax error: 'clockticks'
                        \___ Bad event name
   ...
 #

Output after:
# perf test 87
87: perf stat events uniquifying : Skip
#

Fixes cb422594d6206 ("perf test: Add stat uniquifying test")
Cc Chun-Tse Shao <[email protected]>
---
 tools/perf/tests/shell/stat+event_uniquifying.sh | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/tests/shell/stat+event_uniquifying.sh +5 -1
index 5ec35c52b7d9..485ee6e8f574 100755
@@ -49,6 +49,11 @@ test_event_uniquifying() {
     uniquified_event_array+=("${uniquified_event}")
   done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]")
 
+  if [ -z "$uniquified_event" ]
+  then
+    err=2
+    return
+  fi
   perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true"
   $perf_command
 
--

2.49.0