[RFC PATCH v3 2/9] tests/acceptance: Fix wait_for_console_pattern() hangs

Philippe Mathieu-Daudé posted 9 patches 6 years, 3 months ago
Maintainers: Kamil Rytarowski <kamil@netbsd.org>
[RFC PATCH v3 2/9] tests/acceptance: Fix wait_for_console_pattern() hangs
Posted by Philippe Mathieu-Daudé 6 years, 3 months ago
From: Philippe Mathieu-Daudé <philmd@redhat.com>

Because of a possible deadlock (QEMU waiting for the socket to
become writable) let's close the console socket as soon as we
stop to use it.

Suggested-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/acceptance/avocado_qemu/__init__.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index a0fe16e47f..39f72945cd 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -75,6 +75,7 @@ def wait_for_console_pattern(test, success_message,
         if success_message in msg:
             break
         if failure_message in msg:
+            console.close()
             fail = 'Failure message found in console: %s' % failure_message
             test.fail(fail)
 
-- 
2.21.0