Skip to content

Commit

Permalink
tests/avocado: exec_command should not consume console output
Browse files Browse the repository at this point in the history
_console_interaction reads data from the console even when there is only
an input string to send, and no output data to wait on. This can cause
lines to be missed by wait_for_console_pattern calls that follows an
exec_command. Fix this by not reading the console if there is no pattern
to wait for.

This solves occasional hangs in ppc_hv_tests.py, usually when run on KVM
hosts that are fast enough to output important lines quickly enough to be
consumed by exec_command, so they get missed by subsequent wait for
pattern calls.

Signed-off-by: Nicholas Piggin <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
  • Loading branch information
npiggin authored and philmd committed Aug 19, 2024
1 parent e922abf commit 4a85f23
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/avocado/avocado_qemu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ def _console_interaction(test, success_message, failure_message,
vm.console_socket.sendall(send_string.encode())
if not keep_sending:
send_string = None # send only once

# Only consume console output if waiting for something
if success_message is None and failure_message is None:
if send_string is None:
break
continue

try:
msg = console.readline().decode().strip()
except UnicodeDecodeError:
Expand Down

0 comments on commit 4a85f23

Please sign in to comment.