qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-


From: Thomas Huth
Subject: Re: [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available
Date: Thu, 14 Oct 2021 08:45:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 11/08/2021 13.08, Peter Maydell wrote:
On Wed, 11 Aug 2021 at 11:00, Thomas Huth <thuth@redhat.com> wrote:

The vhost-user-blk-test currently hangs if QTEST_QEMU_STORAGE_DAEMON_BINARY
points to a non-existing binary. Let's improve this situation by checking
for the availability of the binary first, so we can fail gracefully if
it is not accessible.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
  tests/qtest/vhost-user-blk-test.c | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/tests/qtest/vhost-user-blk-test.c 
b/tests/qtest/vhost-user-blk-test.c
index 8796c74ca4..6f108a1b62 100644
--- a/tests/qtest/vhost-user-blk-test.c
+++ b/tests/qtest/vhost-user-blk-test.c
@@ -789,6 +789,14 @@ static const char *qtest_qemu_storage_daemon_binary(void)
          exit(0);
      }

+    /* If we've got a path to the binary, check whether we can access it */
+    if (strchr(qemu_storage_daemon_bin, '/') &&
+        access(qemu_storage_daemon_bin, X_OK) != 0) {
+        fprintf(stderr, "ERROR: '%s' is not accessible\n",
+                qemu_storage_daemon_bin);
+        exit(1);
+    }

It makes sense not to bother starting the test if the binary isn't
even present, but why does the test hang? Shouldn't QEMU cleanly
exit rather than hanging if it turns out that it can't contact
the daemon ?

Sorry for the late reply: I think this happens due to the way we run that qtest: The test program forks to run the storage daemon. If that daemon binary is not available, or exits prematurely, the original program does not notice and hangs. Maybe we should intercept the SIGCHLD signal for such cases?

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]