[PATCH] perf test: perf stat tests fails on s390

Thomas Richter posted 1 patch 3 weeks, 2 days ago
There is a newer version of this series
tools/perf/tests/shell/stat.sh | 5 +++++
1 file changed, 5 insertions(+)
[PATCH] perf test: perf stat tests fails on s390
Posted by Thomas Richter 3 weeks, 2 days ago
The test case 'perf stat tests' fails on s390 z/VM machines. The
root cause is the unsupported CPU measurement facility on z/VM.
Therefore the events cycles and instructions do not exist and
are unsupported. This cause the subtest
  Hide zero events stat test
to fail.

Output before:
 # perf test 116
 116: perf stat tests  : FAILED!

 === Test Summary ===
 Passed main tests : 0
 Passed subtests   : 0
 Skipped tests     : 0
 Failed tests      : 1
 List of failed tests:
  116: perf stat tests
 #

Output after:
 # ./perf test 116
 116: perf stat tests  : Ok

 === Test Summary ===
 Passed main tests : 1
 Passed subtests   : 0
 Skipped tests     : 0
 Failed tests      : 0
 #

Fixes: 64724095a33f ("perf stat: Add --hide-zero-events option to suppress zero-count events")
Cc: Aaron Tomlin <atomlin@atomlin.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/perf/tests/shell/stat.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/tests/shell/stat.sh b/tools/perf/tests/shell/stat.sh
index 298ce454b45a..41bac99300a1 100755
--- a/tools/perf/tests/shell/stat.sh
+++ b/tools/perf/tests/shell/stat.sh
@@ -583,6 +583,11 @@ test_hide_zero_events_stat() {
   # Check that --metric-only works with --hide-zero-events
   if ! perf stat --hide-zero-events --metric-only -e instructions,cycles true > "${stat_output}" 2>&1
   then
+    grep -q 'No supported events found' "${stat_output}"
+    if [ $? -eq 0 ]; then
+      echo "Hide zero events stat test [Skipped - events not supported]"
+      return
+    fi
     echo "Hide zero events stat test [Failed - metric-only command failed]"
     err=1
     return
-- 
2.55.0
Re: [PATCH] perf test: perf stat tests fails on s390
Posted by Aaron Tomlin 3 weeks, 2 days ago
On Wed, Sep 02, 2026 at 01:52:18PM +0200, Thomas Richter wrote:
> The test case 'perf stat tests' fails on s390 z/VM machines. The
> root cause is the unsupported CPU measurement facility on z/VM.
> Therefore the events cycles and instructions do not exist and
> are unsupported. This cause the subtest
>   Hide zero events stat test
> to fail.
> 
> Output before:
>  # perf test 116
>  116: perf stat tests  : FAILED!
> 
>  === Test Summary ===
>  Passed main tests : 0
>  Passed subtests   : 0
>  Skipped tests     : 0
>  Failed tests      : 1
>  List of failed tests:
>   116: perf stat tests
>  #
> 
> Output after:
>  # ./perf test 116
>  116: perf stat tests  : Ok
> 
>  === Test Summary ===
>  Passed main tests : 1
>  Passed subtests   : 0
>  Skipped tests     : 0
>  Failed tests      : 0
>  #
> 
> Fixes: 64724095a33f ("perf stat: Add --hide-zero-events option to suppress zero-count events")
> Cc: Aaron Tomlin <atomlin@atomlin.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> ---
>  tools/perf/tests/shell/stat.sh | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/perf/tests/shell/stat.sh b/tools/perf/tests/shell/stat.sh
> index 298ce454b45a..41bac99300a1 100755
> --- a/tools/perf/tests/shell/stat.sh
> +++ b/tools/perf/tests/shell/stat.sh
> @@ -583,6 +583,11 @@ test_hide_zero_events_stat() {
>    # Check that --metric-only works with --hide-zero-events
>    if ! perf stat --hide-zero-events --metric-only -e instructions,cycles true > "${stat_output}" 2>&1
>    then
> +    grep -q 'No supported events found' "${stat_output}"
> +    if [ $? -eq 0 ]; then
> +      echo "Hide zero events stat test [Skipped - events not supported]"
> +      return
> +    fi
>      echo "Hide zero events stat test [Failed - metric-only command failed]"
>      err=1
>      return
> -- 
> 2.55.0
> 

Hi Thomas,

This makes sense.

However, please see the valid feedback from Sashiko [1]. Otherwise:

Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>

[1]: https://sashiko.dev/#/patchset/20260902115218.2977412-1-tmricht%40linux.ibm.com

Kind regards,
-- 
Aaron Tomlin