From: Thomas Huth <thuth@redhat.com>
To: "Cédric Le Goater" <clg@redhat.com>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Troy Lee" <leetroy@gmail.com>,
"Jamin Lin" <jamin_lin@aspeedtech.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v1 1/4] tests/functional: Introduce _console_read()
Date: Tue, 12 Nov 2024 08:11:36 +0100 [thread overview]
Message-ID: <3bea84f6-098f-4956-a40d-651b567212c2@redhat.com> (raw)
In-Reply-To: <20241112062806.838717-2-clg@redhat.com>
On 12/11/2024 07.28, Cédric Le Goater wrote:
> Interaction with the console has been a problem in our avocado
> tests. In some cases, the expected string does not match in the
> output, causing the test to fail with a timeout. These were worked
> around by sleeping before reading the console and even with SSH
> connections in some places.
>
> To fix, process the console output char by char and not with
> readline. This routine was largely inspired by console_wait() in
> tests/vm/basevm.py.
>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
> tests/functional/qemu_test/cmd.py | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
> index cbabb1ceed3c..bb39857e6cae 100644
> --- a/tests/functional/qemu_test/cmd.py
> +++ b/tests/functional/qemu_test/cmd.py
> @@ -12,6 +12,7 @@
> # later. See the COPYING file in the top-level directory.
>
> import logging
> +import re
> import os
> import os.path
> import subprocess
> @@ -78,6 +79,20 @@ def run_cmd(args):
> def is_readable_executable_file(path):
> return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK)
>
> +def _console_read(vm, expect, expectalt = None):
> + output = ""
> + while True:
> + data = vm.console_socket.recv(1)
> + if not data:
> + break
> + output += data.decode("latin1")
> + if expect in output:
> + break
> + if "\r" in output or "\n" in output:
> + lines = re.split("[\r\n]", output)
> + output = lines.pop()
> + return output
> +
The idea looks promising, but I just realized that this is breaking the
console.log:
$ cat
tests/functional/arm/test_arm_aspeed.AST2x00Machine.test_arm_ast2500_evb_buildroot/console.log
| wc -l
12
Without your patch, the log is way more verbose:
$ cat
tests/functional/arm/test_arm_aspeed.AST2x00Machine.test_arm_ast2500_evb_buildroot/console.log
| wc -l
232
Could you please have another look?
Thanks,
Thomas
next prev parent reply other threads:[~2024-11-12 7:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 6:28 [PATCH v1 0/4] tests/functional: Finish conversion of Aspeed tests Cédric Le Goater
2024-11-12 6:28 ` [PATCH v1 1/4] tests/functional: Introduce _console_read() Cédric Le Goater
2024-11-12 7:11 ` Thomas Huth [this message]
2024-11-12 8:01 ` Cédric Le Goater
2024-11-12 6:28 ` [PATCH v1 2/4] tests/functional: Convert Aspeed aarch64 SDK tests Cédric Le Goater
2024-11-12 6:53 ` Thomas Huth
2024-11-12 8:02 ` Cédric Le Goater
2024-11-12 6:28 ` [PATCH v1 3/4] tests/functional: Convert Aspeed arm " Cédric Le Goater
2024-11-12 6:28 ` [PATCH v1 4/4] tests/functional: Remove sleep workarounds from Aspeed tests Cédric Le Goater
2024-11-12 7:14 ` Thomas Huth
2024-11-12 8:03 ` Cédric Le Goater
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=3bea84f6-098f-4956-a40d-651b567212c2@redhat.com \
--to=thuth@redhat.com \
--cc=andrew@codeconstruct.com.au \
--cc=clg@redhat.com \
--cc=jamin_lin@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.