From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 07/17] perf tests diff: Exercise the output options
Date: Tue, 24 Nov 2026 18:57:30 +0000 [thread overview]
Message-ID: <sashiko-outbox-231866@kernel.org> (raw)
In-Reply-To: <20261124184604.24983-8-acme@kernel.org>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] perf tests diff: unchecked perf diff exit status and u64
overflow in --time
- [Low] perf tests diff: mktemp files leaked when
skip_test_missing_symbol() exits
- [Low] perf tests diff: test_three_files() overwrites err and
test_options() runs
--
commit c0af815c226f5a563d83e161e3f9885c8829c0ce
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf tests diff: Exercise the output options
This commit extends the perf diff shell test to record a second workload
for the third data file and adds test_options() to verify output and
filtering options.
> diff --git a/tools/perf/tests/shell/diff.sh b/tools/perf/tests/shell/diff.sh
> index 88f37b8ef8936..d2fbc8a8c2c36 100755
> --- a/tools/perf/tests/shell/diff.sh
> +++ b/tools/perf/tests/shell/diff.sh
> @@ -8,14 +8,18 @@ err=0
> perfdata1=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
> perfdata2=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
> perfdata3=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
> +diffout=$(mktemp /tmp/__perf_test.perf.diff.out.XXXXX)
> testprog="perf test -w thloop"
> +testprog2="perf test -w noploop"
>
> shelldir=$(dirname "$0")
> . "${shelldir}"/lib/perf_has_symbol.sh
>
> testsym="test_loop"
> +testsym2="noploop"
>
> skip_test_missing_symbol ${testsym}
> +skip_test_missing_symbol ${testsym2}
[Severity: Low]
Does skip_test_missing_symbol leak perfdata1, perfdata2, perfdata3, and
diffout in /tmp when either symbol is missing? skip_test_missing_symbol
calls exit 2 before trap_cleanup is installed on EXIT.
[ ... ]
> @@ -100,8 +110,175 @@ test_three_files() {
> echo "Basic three file diff test [Success]"
> }
>
> +test_options() {
> + echo "Diff options test"
[ ... ]
> + # A window starting at the beginning of the data shows it all, a
> + # window starting after the last sample shows nothing
> + if ! perf diff --time 0, "${perfdata1}" "${perfdata2}" | grep -q "${testsym}"
> + then
> + echo "Diff options test [Failed: --time]"
> + err=1
> + return
> + fi
> + if perf diff --time 9000000000000000000, "${perfdata1}" "${perfdata2}" | \
> + grep -q "${testsym}"
> + then
> + echo "Diff options test [Failed: --time shows samples outside the window]"
> + err=1
> + return
> + fi
[Severity: Medium]
Can this negative --time check pass even if perf diff fails, and does
9000000000000000000 overflow u64 in parse_nsec_time()?
Because the pipeline runs inside a positive if condition without pipefail,
any error exit from perf diff produces no stdout, causing grep -q to return
1 and the check to succeed silently (unlike the --baseline-only check
above, which writes to ${diffout} and checks perf diff's status first).
In addition, parse_nsec_time() treats the number before the decimal point
as seconds and multiplies by NSEC_PER_SEC in u64 arithmetic:
tools/perf/util/time-utils.c:parse_nsec_time() {
...
time_sec = strtoull(str, &end, 10);
...
*ptime = time_sec * NSEC_PER_SEC + time_nsec;
return 0;
}
9000000000000000000 overflows u64 when multiplied by 10^9 and wraps to
~5.3e18 ns.
[ ... ]
> test_two_files
> test_three_files
> +test_options
>
> cleanup
> exit $err
[Severity: Low]
If test_two_files fails (setting err=1), or if make_data fails partway
through test_three_files, should the subsequent test functions still run?
test_three_files overwrites global err with 0 when make_data succeeds,
masking an earlier failure in test_two_files, and an early return from
test_three_files leaves test_options running against unrecorded mktemp
files.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124184604.24983-1-acme@kernel.org?part=7
next prev parent reply other threads:[~2026-11-24 18:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 18:45 [PATCH v1 00/17] perf tests: Add coverage for the untested perf subcommands Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 01/17] perf tests top: Pin the ring buffer size Arnaldo Carvalho de Melo
2026-11-24 19:01 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 02/17] perf tests sched: Exercise the sched views and options Arnaldo Carvalho de Melo
2026-11-24 18:58 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 03/17] perf tests help: Add a basic perf help test Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 04/17] perf tests config: Exercise the config file and list options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 05/17] perf tests script: Exercise the list, fields and dump options Arnaldo Carvalho de Melo
2026-11-24 18:54 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 06/17] perf tests sort: Exercise the report and diff sort keys Arnaldo Carvalho de Melo
2026-11-24 19:02 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 07/17] perf tests diff: Exercise the output options Arnaldo Carvalho de Melo
2026-11-24 18:57 ` sashiko-bot [this message]
2026-11-24 18:45 ` [PATCH v1 08/17] perf tests annotate: Exercise the output and filter options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 09/17] perf tests report: Exercise the output and format options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 10/17] perf tests record: Exercise more record options Arnaldo Carvalho de Melo
2026-11-24 19:03 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 11/17] perf tests trace: Exercise the tracing options Arnaldo Carvalho de Melo
2026-11-24 19:02 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 12/17] perf tests timechart: Exercise the report options Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 13/17] perf tests kmem: Add a basic perf kmem test Arnaldo Carvalho de Melo
2026-11-24 18:57 ` sashiko-bot
2026-11-24 18:46 ` [PATCH v1 14/17] perf tests bench: Add smoke tests for perf bench Arnaldo Carvalho de Melo
2026-11-24 19:03 ` sashiko-bot
2026-11-24 18:46 ` [PATCH v1 15/17] perf tests lock: Exercise perf lock report and info Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 16/17] perf tests probe: Exercise the variable and line listing Arnaldo Carvalho de Melo
2026-11-24 19:00 ` sashiko-bot
2026-11-24 18:46 ` [PATCH v1 17/17] perf tests report: Exercise the TUI browsers Arnaldo Carvalho de Melo
2026-11-24 19:01 ` sashiko-bot
2026-11-24 19:03 ` [PATCH v1 00/17] perf tests: Add coverage for the untested perf subcommands 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=sashiko-outbox-231866@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acme@kernel.org \
--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