Re: [PATCH v2 4/4] perf test: Update PE file test for other locations

From: Namhyung Kim

Date: Mon Oct 12 2026 - 19:44:06 EST


On Mon, Oct 12, 2026 at 04:11:27PM -0700, Ian Rogers wrote:
> On Mon, Oct 12, 2026 at 4:06 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > On Mon, Oct 12, 2026 at 02:51:52PM -0700, Ian Rogers wrote:
> > > On Sun, Oct 11, 2026 at 10:30 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> > > >
> > > > The test__pe_file_parsing() expects the test is in the tools/perf
> > > > directory, but it could be root or a separate build directory. Let's
> > > > update the logic to try other paths like in the shell_tests__dir_fd().
> > > >
> > > > Also add some debug messages to inform users why it's skipped.
> > > >
> > > > Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> > > > ---
> > > > tools/perf/tests/pe-file-parsing.c | 13 +++++++++++--
> > > > 1 file changed, 11 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/tools/perf/tests/pe-file-parsing.c b/tools/perf/tests/pe-file-parsing.c
> > > > index 3979f38bf127c218..78dae7e43603b9f8 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"
> > >
> > > I'm not sure where "source/tests" comes from?
> >
> > AFAIK it's set when you pass O=$(DIR) option when you build perf and it
> > points the source tree.
>
> Ah, Andi's change:
> https://lore.kernel.org/r/20240807231823.898979-1-ak@xxxxxxxxxxxxxxx
>
> > > nit: could we add the exec_path case to the list?
> >
> > It's checked right after. :)
>
> Right, I think you can avoid the duplicated logic by having tests_dir
> also have path_dir as the last entry. It'd mean always doing the
> snprintf but performance doesn't matter much in a test.

Ah ok, will do!

Thanks,
Namhyung