Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Breno Rodrigues Alves" <breno3011alves@gmail.com>,
	linux-perf-users@vger.kernel.org
Subject: Re: [RFC PATCH 1/5] perf/kselftest: convert prefix.pl to Python
Date: Sun, 18 Oct 2026 13:01:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-176141@kernel.org> (raw)
In-Reply-To: <20261018125641.23064-2-breno3011alves@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] selftests: prefix.py is unused and not installed by Makefile or runner.sh
- [Low] selftests: missing trailing newline at end of prefix.py
--

commit f99bbafab30726cd18857c0cc9a21eeae2499158
Author: Breno Rodrigues Alves <breno3011alves@gmail.com>

perf/kselftest: convert prefix.pl to Python

This commit adds a Python 3 re-implementation of
tools/testing/selftests/kselftest/prefix.pl to prefix input lines with
"# " in an unbuffered manner.

> diff --git a/tools/testing/selftests/kselftest/prefix.py b/tools/testing/selftests/kselftest/prefix.py
> new file mode 100755
> index 0000000000000..2bf16b37dee63
> --- /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():

[Severity: Medium]
Should tools/testing/selftests/kselftest/runner.sh and
tools/testing/selftests/Makefile also be updated to use and install
prefix.py, and remove prefix.pl?

Currently, tap_prefix() in tools/testing/selftests/kselftest/runner.sh
still checks for /usr/bin/perl and invokes prefix.pl:

tap_prefix()
{
	if [ ! -x /usr/bin/perl ]; then
		sed -e 's/^/# /'
	else
		"$BASE_DIR"/kselftest/prefix.pl
	fi
}

And the install target in tools/testing/selftests/Makefile still only
installs prefix.pl:

	install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/

Without updating those callers, prefix.py is never executed or installed.

> +    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

[Severity: Low]
Could a trailing newline be added at the end of
tools/testing/selftests/kselftest/prefix.py?

[]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261018125641.23064-1-breno3011alves@gmail.com?part=1

  reply	other threads:[~2026-10-18 13:01 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 ` [RFC PATCH 1/5] perf/kselftest: convert prefix.pl " Breno Rodrigues Alves
2026-10-18 13:01   ` sashiko-bot [this message]
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=sashiko-outbox-176141@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=breno3011alves@gmail.com \
    --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