aboutsummaryrefslogtreecommitdiff
path: root/tests/avocado
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2023-09-14 16:54:21 +0100
committerAlex Bennée <alex.bennee@linaro.org>2023-09-20 15:06:33 +0100
commitf0ec14c78c4583fc34c16625ca6bf3900bcccba5 (patch)
treee8d1c2ec32c23dad2f675c0473fdfd305ec5d96a /tests/avocado
parenteca74afd7dfbe7363fb2b7e8a7b1dae4bc05cd25 (diff)
downloadqemu-f0ec14c78c4583fc34c16625ca6bf3900bcccba5.zip
qemu-f0ec14c78c4583fc34c16625ca6bf3900bcccba5.tar.gz
qemu-f0ec14c78c4583fc34c16625ca6bf3900bcccba5.tar.bz2
tests/avocado: Fix console data loss
Occasionally some avocado tests will fail waiting for console line despite the machine running correctly. Console data goes missing, as can be seen in the console log. This is due to _console_interaction calling makefile() on the console socket each time it is invoked, which must be losing old buffer contents when going out of scope. It is not enough to makefile() with buffered=0. That helps significantly but data loss is still possible. My guess is that readline() has a line buffer even when the file is in unbuffered mode, that can eat data. Fix this by providing a console file that persists for the life of the console. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: "Daniel P. Berrangé" <berrange@redhat.com> Message-Id: <20230912131340.405619-1-npiggin@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Acked-by: John Snow <jsnow@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230914155422.426639-9-alex.bennee@linaro.org>
Diffstat (limited to 'tests/avocado')
-rw-r--r--tests/avocado/avocado_qemu/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index 3309090..0172a35 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -137,7 +137,7 @@ def _console_interaction(test, success_message, failure_message,
assert not keep_sending or send_string
if vm is None:
vm = test.vm
- console = vm.console_socket.makefile(mode='rb', encoding='utf-8')
+ console = vm.console_file
console_logger = logging.getLogger('console')
while True:
if send_string: