Re: [RFC PATCH v3 2/2] perf/tests: convert check_*.pl helpers to Python
From: Ian Rogers
Date: Wed Oct 21 2026 - 12:20:30 EST
On Sun, Oct 18, 2026 at 6:43 AM Breno Rodrigues Alves
<breno3011alves@xxxxxxxxx> wrote:
>
> Faithful re-implementations of the four Perl test helpers in
> tools/perf/tests/shell/common/:
> - check_all_patterns_found.pl
> - check_no_patterns_found.pl
> - check_all_lines_matched.pl
> - check_errors_whitelisted.pl
>
> Same CLI, same output, same exit codes. All use only the Python
> standard library. TESTLOG_VERBOSITY and TESTLOG_ERR_MSG_MAX_LINES
> environment handling is preserved.
>
> Update all 37 call sites across base_probe/ and base_report/ to
> invoke the .py versions. Update Makefile.perf's install-tests
> target to install *.py files (in addition to *.sh) from
> tests/shell/common/. Remove the four old .pl files.
>
> All four were verified byte-for-byte identical to their Perl
> counterparts on synthetic inputs.
>
> Signed-off-by: Breno Rodrigues Alves <breno3011alves@xxxxxxxxx>
Hi,
The build in perf-tools-next is now running mypy and pylint (when
available) on all python scripts:
https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/tests/Build?h=perf-tools-next#n100
We disable some options:
https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/Makefile.perf?h=perf-tools-next#n317
Applying this patch breaks the build for me because of this and 1
pylint issue. I see:
```
$ make -k -C tools/perf O=/tmp/perf12 DEBUG=1 all
make: Entering directory '.../tools/perf'
BUILD: Doing 'make -j28' parallel build
Auto-detecting system features:
... libdw: [ on ]
... glibc: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... python-module: [ on ]
... libcapstone: [ on ]
... llvm-perf: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... bpf: [ on ]
... libaio: [ on ]
... libzstd: [ on ]
... libopenssl: [ on ]
... rust: [ on ]
INSTALL libsubcmd_headers
INSTALL libperf_headers
TEST /tmp/perf12/tests/shell/common/check_errors_whitelisted.py.pylint_log
INSTALL libsymbol_headers
INSTALL libapi_headers
INSTALL libbpf_headers
************* Module check_errors_whitelisted
tests/shell/common/check_errors_whitelisted.py:13:17: W1514: Using
open without explicitly specifying an encoding (unspecified-encoding)
------------------------------------------------------------------
Your code has been rated at 9.76/10 (previous run: 9.76/10, +0.00)
make[3]: *** [tests/Build:124:
/tmp/perf12/tests/shell/common/check_errors_whitelisted.py.pylint_log]
Error 1
make[3]: Target 'pylint' not remade because of errors.
make[2]: *** [Makefile.perf:690: pylint-tests] Error 2
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile.perf:343: sub-make] Error 2
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:82: all] Error 2
```
I like the change although the perf tool and kselftests may get merged
through different trees. It may be better to separate the patches.
Thanks,
Ian