Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Namhyung Kim" <namhyung@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 4/4] perf test: Update test for --for-each-cgroup option
Date: Fri, 10 Jul 2026 23:52:00 +0000	[thread overview]
Message-ID: <20260710235200.CD3001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260710234143.1934263-4-namhyung@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The `check_evlist_expand()` test fails to exercise the bug it intends to verify because it specifies `-e cpu-clock`.
- [Medium] Bash pipeline semantics mask `perf stat` command failures, potentially causing false test passes.
--

--- Patch [4]: [PATCH v2 4/4] perf test: Update test for --for-each-cgroup option ---
commit b42b21fdf494fb61acde3f563ac29e9b49df9327
Author: Namhyung Kim <namhyung@kernel.org>

perf test: Update test for --for-each-cgroup option

This commit updates the stat_bpf_counters_cgrp.sh test to simply check the
number of output lines with and without the --for-each-cgroup option.

> diff --git a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
> index ff2e06c408bc6..17b17b112169c 100755
> --- a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
> +++ b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
[ ... ]
> @@ -58,9 +58,24 @@ check_system_wide_counted()
>  	fi
>  }
>  
> +# Missing flags in evlist__clone() resulted in different output.
> +# Just check the number of output lines for simple verification.
> +check_evlist_expand()
> +{
> +	normal_output=$(perf stat -a -e cpu-clock -x, true 2>&1 | wc -l)
> +	expand_output=$(perf stat -a -e cpu-clock -x, --bpf-counters --for-each-cgroup / true 2>&1 | wc -l)

[Severity: Medium]
Will this actually test the bug with evlist__clone() missing flags?

By specifying -e cpu-clock, the loading of default events is disabled,
meaning default_metricgroup and default_show_events are false. This prevents
the duplication bug from occurring during evsel__clone(), rendering the test
ineffective at catching the regression it was meant to verify.

[Severity: Medium]
Also, does using the pipeline | wc -l mask any failures from perf stat?

Without set -o pipefail, the pipeline's exit code will just be the success of
wc -l, so if perf stat fails (e.g. from missing permissions or PMU errors),
the script will miss the failure and might falsely report a test pass.

> +	if [ "${normal_output}" != "${expand_output}" ]; then
> +		if [ "${verbose}" = "1" ]; then
> +			echo "Normal output has ${normal_output} lines, but it now has ${expand_output}"
> +		fi
> +		exit 1
> +	fi
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260710234143.1934263-1-namhyung@kernel.org?part=4

  reply	other threads:[~2026-07-10 23:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 23:41 [PATCH v2 1/4] perf stat: Fix duplicate output with --for-each-cgroup Namhyung Kim
2026-07-10 23:41 ` [PATCH v2 2/4] perf evsel: Remove unused BPF related fields Namhyung Kim
2026-07-10 23:41 ` [PATCH v2 3/4] perf evsel: Arrange some fields that should be cloned Namhyung Kim
2026-07-10 23:41 ` [PATCH v2 4/4] perf test: Update test for --for-each-cgroup option Namhyung Kim
2026-07-10 23:52   ` sashiko-bot [this message]
2026-07-10 23:59     ` Namhyung Kim

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=20260710235200.CD3001F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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