qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] tests/avocado: Fix exec_command and enable ppc_hv_tests.py
@ 2024-08-05 23:28 Nicholas Piggin
  2024-08-05 23:28 ` [PATCH 1/2] tests/avocado: exec_command should not consume console output Nicholas Piggin
  2024-08-05 23:28 ` [PATCH 2/2] tests/avocado: Mark ppc_hv_tests.py as non-flaky after fixed console interaction Nicholas Piggin
  0 siblings, 2 replies; 4+ messages in thread
From: Nicholas Piggin @ 2024-08-05 23:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Fabiano Rosas, Paolo Bonzini,
	Philippe Mathieu-Daudé, John Snow, qemu-ppc,
	Richard Henderson, Ani Sinha, Alex Bennée, Thomas Huth

This fixes an issue with exec_command eating console output and causing
the ppc_hv_tests.py to fail. A few other tests also use exec_command but
I didn't see any that subsequently checked console output.

Thanks,
Nick

Nicholas Piggin (2):
  tests/avocado: exec_command should not consume console output
  tests/avocado: Mark ppc_hv_tests.py as non-flaky after fixed console
    interaction

 tests/avocado/avocado_qemu/__init__.py | 7 +++++++
 tests/avocado/ppc_hv_tests.py          | 1 -
 2 files changed, 7 insertions(+), 1 deletion(-)

-- 
2.45.2



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] tests/avocado: exec_command should not consume console output
  2024-08-05 23:28 [PATCH 0/2] tests/avocado: Fix exec_command and enable ppc_hv_tests.py Nicholas Piggin
@ 2024-08-05 23:28 ` Nicholas Piggin
  2024-08-15 14:40   ` Thomas Huth
  2024-08-05 23:28 ` [PATCH 2/2] tests/avocado: Mark ppc_hv_tests.py as non-flaky after fixed console interaction Nicholas Piggin
  1 sibling, 1 reply; 4+ messages in thread
From: Nicholas Piggin @ 2024-08-05 23:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Fabiano Rosas, Paolo Bonzini,
	Philippe Mathieu-Daudé, John Snow, qemu-ppc,
	Richard Henderson, Ani Sinha, Alex Bennée, Thomas Huth

_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 <npiggin@gmail.com>
---
 tests/avocado/avocado_qemu/__init__.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index a3da2a96bb..ef935614cf 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -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:
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] tests/avocado: Mark ppc_hv_tests.py as non-flaky after fixed console interaction
  2024-08-05 23:28 [PATCH 0/2] tests/avocado: Fix exec_command and enable ppc_hv_tests.py Nicholas Piggin
  2024-08-05 23:28 ` [PATCH 1/2] tests/avocado: exec_command should not consume console output Nicholas Piggin
@ 2024-08-05 23:28 ` Nicholas Piggin
  1 sibling, 0 replies; 4+ messages in thread
From: Nicholas Piggin @ 2024-08-05 23:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Fabiano Rosas, Paolo Bonzini,
	Philippe Mathieu-Daudé, John Snow, qemu-ppc,
	Richard Henderson, Ani Sinha, Alex Bennée, Thomas Huth

Now that exec_command doesn't incorrectly consume console output,
and guest time is set correctly, ppc_hv_tests.py is working more
reliably. Try marking it non-flaky.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 tests/avocado/ppc_hv_tests.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/avocado/ppc_hv_tests.py b/tests/avocado/ppc_hv_tests.py
index bf8822bb97..0e83bbac71 100644
--- a/tests/avocado/ppc_hv_tests.py
+++ b/tests/avocado/ppc_hv_tests.py
@@ -45,7 +45,6 @@ def missing_deps():
 # QEMU already installed and use that.
 # XXX: The order of these tests seems to matter, see git blame.
 @skipIf(missing_deps(), 'dependencies (%s) not installed' % ','.join(deps))
-@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test sometimes gets stuck due to console handling problem')
 @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
 @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
 class HypervisorTest(QemuSystemTest):
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] tests/avocado: exec_command should not consume console output
  2024-08-05 23:28 ` [PATCH 1/2] tests/avocado: exec_command should not consume console output Nicholas Piggin
@ 2024-08-15 14:40   ` Thomas Huth
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2024-08-15 14:40 UTC (permalink / raw)
  To: Nicholas Piggin, qemu-devel
  Cc: Fabiano Rosas, Paolo Bonzini, Philippe Mathieu-Daudé,
	John Snow, qemu-ppc, Richard Henderson, Ani Sinha,
	Alex Bennée

On 06/08/2024 01.28, Nicholas Piggin wrote:
> _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 <npiggin@gmail.com>
> ---
>   tests/avocado/avocado_qemu/__init__.py | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
> index a3da2a96bb..ef935614cf 100644
> --- a/tests/avocado/avocado_qemu/__init__.py
> +++ b/tests/avocado/avocado_qemu/__init__.py
> @@ -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:

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-15 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-05 23:28 [PATCH 0/2] tests/avocado: Fix exec_command and enable ppc_hv_tests.py Nicholas Piggin
2024-08-05 23:28 ` [PATCH 1/2] tests/avocado: exec_command should not consume console output Nicholas Piggin
2024-08-15 14:40   ` Thomas Huth
2024-08-05 23:28 ` [PATCH 2/2] tests/avocado: Mark ppc_hv_tests.py as non-flaky after fixed console interaction Nicholas Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).