]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/functional: fix infinite loop on console EOF
authorDaniel P. Berrangé <berrange@redhat.com>
Mon, 8 Sep 2025 13:57:19 +0000 (14:57 +0100)
committerThomas Huth <thuth@redhat.com>
Tue, 9 Sep 2025 10:41:18 +0000 (12:41 +0200)
The 'recv' method will return an empty byte array, not None, when
the socket has EOF.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20250908135722.3375580-2-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/functional/qemu_test/cmd.py

index 8069c89730b6b60495f58b4ed76de6e23db92975..f544566245ba3ffdd07d708a2885d09d9e941127 100644 (file)
@@ -54,7 +54,7 @@ def _console_read_line_until_match(test, vm, success, failure):
     done = False
     while True:
         c = vm.console_socket.recv(1)
-        if c is None:
+        if not c:
             done = True
             test.fail(
                 f"EOF in console, expected '{success}'")