BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v2 5/7] perf test: Enhance annotate test coverage and isolate config
Date: Tue, 09 Jun 2026 07:15:58 +0000	[thread overview]
Message-ID: <20260609071558.C8CB91F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260609070732.545416-6-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Uninitialized variable and incompatible data format causes `test_disassembler` to unconditionally fail.
--

commit 5f0bdfa4980785631dd9a8024ff9f43baa234caa
Author: Ian Rogers <irogers@google.com>

perf test: Enhance annotate test coverage and isolate config

This commit updates the annotate.sh test to support different disassembler
backends via the new --disassembler command-line option. It also isolates the
test script from host environment pollution by exporting PERF_CONFIG=/dev/null.

> diff --git a/tools/perf/tests/shell/annotate.sh b/tools/perf/tests/shell/annotate.sh
> index 689de58e92384..2c06d2670cb18 100755
> --- a/tools/perf/tests/shell/annotate.sh
> +++ b/tools/perf/tests/shell/annotate.sh
[ ... ]
> +test_disassembler() {
> +  disassembler=$1
> +  feature=$2
[ ... ]
> +  perf annotate --no-demangle -i "${perfdata}" --stdio --percent-limit 10 --disassembler "${disassembler}" 2> /dev/null > "${perfout}" || ret=$?
> +
> +  if [ "x${ret}" != "x0" ]
> +  then
> +    echo "annotate with ${disassembler} [Failed: perf annotate error]"
> +    err=1
> +    return 0
> +  fi

[Severity: Medium]
Does this evaluation unconditionally fail the test when perf annotate succeeds?

If the perf annotate command is successful, the short-circuit `|| ret=$?` means
ret is skipped and never assigned. Because ret is not initialized as a local
variable at the start of test_disassembler(), it remains empty. The subsequent
check then evaluates to `[ "x" != "x0" ]`, which is always true and incorrectly
flags a success as a failure.

Additionally, will reading `${perfdata}` as a regular file here cause an issue
due to the test execution order?

>  test_basic Basic
>  test_basic Pipe
>  
> +if [ "${err}" -eq 0 ]
> +then
> +  test_disassembler "objdump" ""

The test_basic sequence runs `test_basic Pipe` immediately before executing
test_disassembler(). This overwrites `${perfdata}` with a pipe-format stream,
so attempting to read it using `-i "${perfdata}"` inside test_disassembler()
may cause perf annotate execution failures.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260609070732.545416-1-irogers@google.com?part=5

  reply	other threads:[~2026-06-09  7:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  7:07 [PATCH v2 0/7] perf annotate: Add elfutils libasm disassembler support Ian Rogers
2026-06-09  7:07 ` [PATCH v2 1/7] tools build: Add feature check for elfutils libasm Ian Rogers
2026-06-09  7:21   ` sashiko-bot
2026-06-09  7:07 ` [PATCH v2 2/7] perf build: Add build support and capability " Ian Rogers
2026-06-09  7:19   ` sashiko-bot
2026-06-09  7:07 ` [PATCH v2 3/7] perf annotate: Implement elfutils libasm disassembler backend Ian Rogers
2026-06-09  7:07 ` [PATCH v2 4/7] perf annotate: Add --disassembler command-line option Ian Rogers
2026-06-09  7:07 ` [PATCH v2 5/7] perf test: Enhance annotate test coverage and isolate config Ian Rogers
2026-06-09  7:15   ` sashiko-bot [this message]
2026-06-09  7:07 ` [PATCH v2 6/7] perf annotate: Support BPF JIT disassembly via genelf Ian Rogers
2026-06-09  7:22   ` sashiko-bot
2026-06-09  7:07 ` [PATCH v2 7/7] perf test: Add BPF JIT annotation test coverage for all disassemblers Ian Rogers
2026-06-09  7:18   ` sashiko-bot

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=20260609071558.C8CB91F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.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