From: Namhyung Kim <namhyung@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 4/4] perf test: Update PE file test for other locations
Date: Mon, 12 Oct 2026 12:42:08 -0700 [thread overview]
Message-ID: <as04EIj_QLOpjZoW@google.com> (raw)
In-Reply-To: <sashiko-outbox-167679@kernel.org>
On Mon, Oct 12, 2026 at 05:38:20AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] perf/tests: spurious test failure due to brittle directory checking
> --
>
> commit 073d3f0f55cefe06ae3b0caf163e2a6505e656b3
> Author: Namhyung Kim <namhyung@kernel.org>
>
> perf test: Update PE file test for other locations
>
> This updates test__pe_file_parsing() to search multiple directories to
> find the tests directory, similar to shell_tests__dir_fd(), and adds
> debug messages when skipped.
>
> > diff --git a/tools/perf/tests/pe-file-parsing.c b/tools/perf/tests/pe-file-parsing.c
> > index 3979f38bf127c..78dae7e43603b 100644
> > --- a/tools/perf/tests/pe-file-parsing.c
> > +++ b/tools/perf/tests/pe-file-parsing.c
> > @@ -74,10 +74,17 @@ static int test__pe_file_parsing(struct test_suite *test __maybe_unused,
> > {
> > struct stat st;
> > char path_dir[PATH_MAX];
> > + static const char * const tests_dirs[] = {
> > + "./tools/perf/tests",
> > + "./tests",
> > + "./source/tests"
> > + };
> >
> > /* First try development tree tests. */
> > - if (!lstat("./tests", &st))
> > - return run_dir("./tests");
> > + for (size_t i = 0; i < ARRAY_SIZE(tests_dirs); ++i) {
> > + if (!lstat(tests_dirs[i], &st))
> > + return run_dir(tests_dirs[i]);
>
> [Severity: Medium]
> Will this cause a spurious test failure if a matching directory exists but
> doesn't contain pe-file.exe?
>
> The new loop eagerly calls run_dir() upon finding a matching directory
> name instead of verifying the actual test file exists.
>
> If pe-file.exe is missing from the matched directory, run_dir() calls
> filename__read_build_id() which returns an error. This causes
> TEST_ASSERT_VAL to immediately return TEST_FAIL, breaking the test suite
> instead of falling back to the installed path.
>
> The commit message notes this logic tries other paths like
> shell_tests__dir_fd(), but shell_tests__dir_fd() merely returns a directory
> descriptor and gracefully continues with zero shell tests if the directory
> is empty. By contrast, run_dir() explicitly asserts file validity and
> aborts the suite with a hard TEST_FAIL.
>
> Should this verify pe-file.exe actually exists before committing to a
> directory and calling run_dir()?
It's expected to point to the tests directory in the source tree, so it
would contain the file. But in a rare case where it runs on a directory
which happens to have a "tests", the test will fail on reading build-id.
I think it's a minor pre-existing issue and maybe we can just ignore it.
Thanks,
Namhyung
next prev parent reply other threads:[~2026-10-12 19:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 5:30 [PATCH v2 1/4] perf symbol: Fix symbol loading from libbfd Namhyung Kim
2026-10-12 5:30 ` [PATCH v2 2/4] perf symbol: Add missing symsrc__destroy() for libbfd Namhyung Kim
2026-10-12 5:36 ` sashiko-bot
2026-10-12 21:53 ` Ian Rogers
2026-10-12 5:30 ` [PATCH v2 3/4] perf symbol: Set dso symtab type " Namhyung Kim
2026-10-12 5:40 ` sashiko-bot
2026-10-12 19:36 ` Namhyung Kim
2026-10-12 5:30 ` [PATCH v2 4/4] perf test: Update PE file test for other locations Namhyung Kim
2026-10-12 5:38 ` sashiko-bot
2026-10-12 19:42 ` Namhyung Kim [this message]
2026-10-12 21:51 ` Ian Rogers
2026-10-12 23:06 ` Namhyung Kim
2026-10-12 23:11 ` Ian Rogers
2026-10-12 23:37 ` Namhyung Kim
2026-10-12 5:37 ` [PATCH v2 1/4] perf symbol: Fix symbol loading from libbfd sashiko-bot
2026-10-12 21:52 ` Ian Rogers
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=as04EIj_QLOpjZoW@google.com \
--to=namhyung@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