From: Breno Rodrigues Alves <breno3011alves@gmail.com>
To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-kselftest@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>, Shuah Khan <shuah@kernel.org>,
Breno Rodrigues Alves <breno3011alves@gmail.com>
Subject: [RFC PATCH 1/5] perf/kselftest: convert prefix.pl to Python
Date: Sun, 18 Oct 2026 09:56:37 -0300 [thread overview]
Message-ID: <20261018125641.23064-2-breno3011alves@gmail.com> (raw)
In-Reply-To: <20261018125641.23064-1-breno3011alves@gmail.com>
Faithful re-implementation of tools/testing/selftests/kselftest/
prefix.pl in Python 3 (stdlib only). Same unbuffered stdin-to-stdout
processing, same "# " prefix behavior.
Verified byte-for-byte identical to the Perl version.
Signed-off-by: Breno Rodrigues Alves <breno3011alves@gmail.com>
---
tools/testing/selftests/kselftest/prefix.py | 24 +++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100755 tools/testing/selftests/kselftest/prefix.py
diff --git a/tools/testing/selftests/kselftest/prefix.py b/tools/testing/selftests/kselftest/prefix.py
new file mode 100755
index 000000000..2bf16b37d
--- /dev/null
+++ b/tools/testing/selftests/kselftest/prefix.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0
+# Prefix all lines with "# ", unbuffered.
+
+import sys
+
+
+def main():
+ needed = True
+ while True:
+ char = sys.stdin.buffer.read(1)
+ if not char:
+ return 0
+ if needed:
+ sys.stdout.buffer.write(b"# ")
+ needed = False
+ sys.stdout.buffer.write(char)
+ sys.stdout.buffer.flush()
+ if char == b"\n":
+ needed = True
+
+
+if __name__ == "__main__":
+ sys.exit(main())
\ No newline at end of file
--
2.43.0
next prev parent reply other threads:[~2026-10-18 12:56 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 12:56 [RFC PATCH 0/5] perf/tests: convert Perl test helpers to Python Breno Rodrigues Alves
2026-10-18 12:56 ` Breno Rodrigues Alves [this message]
2026-10-18 13:01 ` [RFC PATCH 1/5] perf/kselftest: convert prefix.pl " sashiko-bot
2026-10-18 12:56 ` [RFC PATCH 2/5] perf/tests: convert check_all_patterns_found.pl " Breno Rodrigues Alves
2026-10-18 13:02 ` sashiko-bot
2026-10-18 12:56 ` [RFC PATCH 3/5] perf/tests: convert check_no_patterns_found.pl " Breno Rodrigues Alves
2026-10-18 13:03 ` sashiko-bot
2026-10-18 12:56 ` [RFC PATCH 4/5] perf/tests: convert check_all_lines_matched.pl " Breno Rodrigues Alves
2026-10-18 13:07 ` sashiko-bot
2026-10-18 12:56 ` [RFC PATCH 5/5] perf/tests: convert check_errors_whitelisted.pl " Breno Rodrigues Alves
2026-10-18 13:02 ` sashiko-bot
2026-10-18 13:30 ` [RFC PATCH v2 0/2] perf: convert Perl test helpers " Breno Rodrigues Alves
2026-10-18 13:30 ` [RFC PATCH v2 1/2] perf/kselftest: convert prefix.pl " Breno Rodrigues Alves
2026-10-18 13:35 ` sashiko-bot
2026-10-18 13:30 ` [RFC PATCH v2 2/2] perf/tests: convert check_*.pl helpers " Breno Rodrigues Alves
2026-10-18 13:34 ` sashiko-bot
2026-10-18 13:43 ` [RFC PATCH v3 0/2] perf: convert Perl test " Breno Rodrigues Alves
2026-10-18 13:43 ` [RFC PATCH v3 1/2] perf/kselftest: convert prefix.pl " Breno Rodrigues Alves
2026-10-18 13:46 ` sashiko-bot
2026-10-18 13:43 ` [RFC PATCH v3 2/2] perf/tests: convert check_*.pl helpers " Breno Rodrigues Alves
2026-10-18 13:45 ` 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=20261018125641.23064-2-breno3011alves@gmail.com \
--to=breno3011alves@gmail.com \
--cc=acme@kernel.org \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=shuah@kernel.org \
/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