Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Richter" <tmricht@linux.ibm.com>
Cc: "Alexander Gordeev" <agordeev@linux.ibm.com>,
	linux-perf-users@vger.kernel.org,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH] perf test: perf stat tests fails on s390
Date: Wed, 02 Sep 2026 11:58:18 +0000	[thread overview]
Message-ID: <20260902115818.D0EA31F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260902115218.2977412-1-tmricht@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Code Fix: Replace with `if grep -q 'No supported events found' "${stat_output}"; then`. Standalone `grep -q` under `set -e` causes unexpected script abort.
--

commit 4b80c04b99f0ab66b8227b70f1041582e256987c
Author: Thomas Richter <tmricht@linux.ibm.com>

perf test: perf stat tests fails on s390

This commit fixes a failure in the 'perf stat tests' on s390 z/VM by skipping
the test if the cycles and instructions events are unsupported. It checks the
output of the failed perf stat command for 'No supported events found' to
determine if the test should be skipped.

> diff --git a/tools/perf/tests/shell/stat.sh b/tools/perf/tests/shell/stat.sh
> index 298ce454b45a1..41bac99300a16 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

[Severity: Medium]
In test_hide_zero_events_stat(), will this standalone grep cause the script
to abort unexpectedly?

If the script is running with 'set -e' and the perf stat command fails for
any reason other than unsupported events, grep will not find a match and will
return a non-zero exit code.

This non-zero exit directly forces a script abort, making the subsequent
'$?' condition and fallback error handlers unreachable.

Should this be combined into the if statement directly?

    if grep -q 'No supported events found' "${stat_output}"; then
        echo "Hide zero events stat test [Skipped - events not supported]"
        return
    fi

> +      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

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260902115218.2977412-1-tmricht@linux.ibm.com?part=1

  reply	other threads:[~2026-09-02 11:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 11:52 [PATCH] perf test: perf stat tests fails on s390 Thomas Richter
2026-09-02 11:58 ` sashiko-bot [this message]
2026-09-02 12:18 ` Aaron Tomlin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260902115818.D0EA31F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tmricht@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox