Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: "Enrico Jörns" <ejo@pengutronix.de>
Cc: openembedded-core@lists.openembedded.org, yocto@pengutronix.de,
	Richard Purdie <richard.purdie@linuxfoundation.org>,
	Alexander Kanavin <alex.kanavin@gmail.com>,
	alexandre.belloni@bootlin.com
Subject: Re: [OE-core] [PATCH v3 4/9] oeqa/utils/qemurunner: support ignoring vt100 escape sequences
Date: Wed, 26 Apr 2023 10:52:20 +0200	[thread overview]
Message-ID: <20230426105220.78e13af1@booty> (raw)
In-Reply-To: <20230425184720.456896-5-ejo@pengutronix.de>

Hello Enrico,

On Tue, 25 Apr 2023 20:47:15 +0200
Enrico Jörns <ejo@pengutronix.de> wrote:

> If we talk to terminals that like colors, we need to ignore the vt100
> escape sequences when matching strings.
> 
> An unprocessed barebox console prompt would e.g. look like:
> 
>   ESC[1;32mbarebox@ESC[1;36mARM QEMU virt64:/ESC[0m
> 
> where we cannot match for something like "barebox@ARM QEMU virt64:/".
> The same applies to colored Linux terminal output of course.
> 
> The "\x1b\[" from the regex catches the standard start of ansii escape
                                                            ^^^^^

I guess you mean "ansi" (single 'i'). I fixed that (and also converted
to uppercase) while applying the patch for testing, no need to resend.

> sequence while the rest catches the actual command code executed.
> 
> Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
> ---
>  meta/lib/oeqa/utils/qemurunner.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
> index 6734cee48d..c3d8e9e815 100644
> --- a/meta/lib/oeqa/utils/qemurunner.py
> +++ b/meta/lib/oeqa/utils/qemurunner.py
> @@ -30,6 +30,8 @@ control_range = list(range(0,32))+list(range(127,160))
>  control_chars = [chr(x) for x in control_range
>                  if chr(x) not in string.printable]
>  re_control_char = re.compile('[%s]' % re.escape("".join(control_chars)))
> +# Regex to remove the ansii (color) control codes from console strings in order to match the text only
                         ^^^^^

Same here.

Best regards,
Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  reply	other threads:[~2023-04-26  8:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25 18:47 [PATCH v3 0/9] Add barebox bootloader support (and testing) Enrico Jorns
2023-04-25 18:47 ` [PATCH v3 1/9] barebox: add initial support Enrico Jorns
2023-04-26 21:00   ` [OE-core] " Luca Ceresoli
2023-04-25 18:47 ` [PATCH v3 2/9] barebox-tools: add initial barebox tools support Enrico Jorns
2023-04-25 18:47 ` [PATCH v3 3/9] barebox: set default BAREBOX_CONFIG for qemu machines Enrico Jorns
2023-04-25 18:47 ` [PATCH v3 4/9] oeqa/utils/qemurunner: support ignoring vt100 escape sequences Enrico Jorns
2023-04-26  8:52   ` Luca Ceresoli [this message]
2023-04-26  9:17     ` [OE-core] " Enrico Jörns
2023-04-25 18:47 ` [PATCH v3 5/9] oeqa/utils/qemurunner: simplify output parsing and make crlf-compatible Enrico Jorns
2023-04-25 18:47 ` [PATCH v3 6/9] oeqa/utils/commands: document runqemu context manager Enrico Jorns
2023-04-25 18:47 ` [PATCH v3 7/9] oeqa: support passing custom boot patterns to runqemu Enrico Jorns
2023-04-25 18:47 ` [PATCH v3 8/9] oeqa/selftest/cases: add barebox tests Enrico Jorns
2023-04-25 18:47 ` [PATCH v3 9/9] oeqa/selftest/cases: add basic u-boot test Enrico Jorns
2023-04-26 12:12 ` [OE-core] [PATCH v3 0/9] Add barebox bootloader support (and testing) Luca Ceresoli
2023-04-26 13:55   ` Enrico Jörns

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=20230426105220.78e13af1@booty \
    --to=luca.ceresoli@bootlin.com \
    --cc=alex.kanavin@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=ejo@pengutronix.de \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=yocto@pengutronix.de \
    /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