Skip to content

RFC perf/kselftest: convert Perl test helpers to Python

Breno Rodrigues Alves linux-kselftest linux-perf-users lkml 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 RFC Latest2 patches 0 repliesNew
  2. v3 RFC2 patches 1 replySuperseded
  3. v2 RFC2 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC5 patches0 repliesSuperseded

Changes in v4 from the cover letter

- Fixed pylint W1514 in check_errors_whitelisted.py by passing an explicit encoding to open():
open(path, encoding="utf-8", errors="surrogateescape")
"surrogateescape" preserves the byte-for-byte behavior of the Perl original, which reads raw bytes.

- Also fixed two issues found while testing the series locally:
* open() failures on the whitelist now exit with the underlying errno (matching Perl's die), e.g. ENOENT -> rc 2, instead of always rc 1.
* stdin/stdout are reconfigured with surrogateescape so that non-UTF-8 bytes in the log (e.g. oops/KASAN output) do not raise UnicodeDecodeError/UnicodeEncodeError, preserving the byte-for-byte behavior of the Perl originals.

- The series is split by tree, addressing Ian's suggestion:
* Patch 1 (kselftest:) touches only tools/testing/selftests/ and can go through the kselftest tree.
* Patch 2 (perf/tests:) touches only tools/perf/ and can go through the perf tree.

- Note on pylint-tests: it fails on tools/perf/tests/shell/lib/ perf_json_output_lint.py with:
W4904: Using deprecated class FileType of module argparse
This is pre-existing in perf-tools-next and reproduces on the base commit without this series. The four files touched by this series pass pylint 10/10 with the flags used by Makefile.perf.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2kselftest: convert prefix.pl to Pythontools/testing/selftests/Makefile tools/testing/selftests/kselftest/prefix.pl tools/testing/selftests/kselftest/prefix.py +1 more+27 -270 replies
2/2perf/tests: convert check_*.pl helpers to Pythontools/perf/Makefile.perf tools/perf/tests/shell/base_probe/test_adding_blacklisted.sh tools/perf/tests/shell/base_probe/test_adding_kernel.sh +12 more+242 -2210 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [RFC PATCH v4 0/2] perf/kselftest: convert Perl test helpers to Python

This is v4 of the series converting the Perl test helpers to Python.

Changes since v3:
- Fixed pylint W1514 in check_errors_whitelisted.py by passing an explicit encoding to open():
open(path, encoding="utf-8", errors="surrogateescape")
"surrogateescape" preserves the byte-for-byte behavior of the Perl original, which reads raw bytes.

- Also fixed two issues found while testing the series locally:
* open() failures on the whitelist now exit with the underlying errno (matching Perl's die), e.g. ENOENT -> rc 2, instead of always rc 1.
* stdin/stdout are reconfigured with surrogateescape so that non-UTF-8 bytes in the log (e.g. oops/KASAN output) do not raise UnicodeDecodeError/UnicodeEncodeError, preserving the byte-for-byte behavior of the Perl originals.

- The series is split by tree, addressing Ian's suggestion:
* Patch 1 (kselftest:) touches only tools/testing/selftests/ and can go through the kselftest tree.
* Patch 2 (perf/tests:) touches only tools/perf/ and can go through the perf tree.

- Note on pylint-tests: it fails on tools/perf/tests/shell/lib/ perf_json_output_lint.py with:
W4904: Using deprecated class FileType of module argparse
This is pre-existing in perf-tools-next and reproduces on the base commit without this series. The four files touched by this series pass pylint 10/10 with the flags used by Makefile.perf.

Breno Rodrigues Alves (2):
kselftest: convert prefix.pl to Python perf/tests: convert check_*.pl helpers to Python

 tools/perf/Makefile.perf                      |  2 +-
 .../base_probe/test_adding_blacklisted.sh     |  6 +-
 .../shell/base_probe/test_adding_kernel.sh    | 44 +++++++-------
 .../perf/tests/shell/base_probe/test_basic.sh | 12 ++--
 .../shell/base_probe/test_invalid_options.sh  |  4 +-
 tools/perf/tests/shell/base_report/setup.sh   |  4 +-
 .../tests/shell/base_report/test_basic.sh     | 54 ++++++++---------
 .../shell/common/check_all_lines_matched.pl   | 39 -------------
 .../shell/common/check_all_lines_matched.py   | 47 +++++++++++++++
 .../shell/common/check_all_patterns_found.pl  | 34 -----------
 .../shell/common/check_all_patterns_found.py  | 37 ++++++++++++
 .../shell/common/check_errors_whitelisted.pl  | 51 ----------------
 .../shell/common/check_errors_whitelisted.py  | 58 +++++++++++++++++++
 .../shell/common/check_no_patterns_found.pl   | 34 -----------
 .../shell/common/check_no_patterns_found.py   | 37 ++++++++++++
 tools/testing/selftests/Makefile              |  2 +-
 tools/testing/selftests/kselftest/prefix.pl   | 24 --------
 tools/testing/selftests/kselftest/prefix.py   | 24 ++++++++
 tools/testing/selftests/kselftest/runner.sh   |  4 +-
 19 files changed, 269 insertions(+), 248 deletions(-)
 delete mode 100755 tools/perf/tests/shell/common/check_all_lines_matched.pl
 create mode 100755 tools/perf/tests/shell/common/check_all_lines_matched.py
 delete mode 100755 tools/perf/tests/shell/common/check_all_patterns_found.pl
 create mode 100755 tools/perf/tests/shell/common/check_all_patterns_found.py
 delete mode 100755 tools/perf/tests/shell/common/check_errors_whitelisted.pl
 create mode 100755 tools/perf/tests/shell/common/check_errors_whitelisted.py
 delete mode 100755 tools/perf/tests/shell/common/check_no_patterns_found.pl
 create mode 100755 tools/perf/tests/shell/common/check_no_patterns_found.py
 delete mode 100755 tools/testing/selftests/kselftest/prefix.pl
 create mode 100755 tools/testing/selftests/kselftest/prefix.py
Signature · 1 line
2.56.0