All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available
@ 2021-08-11  9:59 Thomas Huth
  2021-08-11 10:10 ` Alexander Bulekov
  2021-08-11 11:08 ` Peter Maydell
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Huth @ 2021-08-11  9:59 UTC (permalink / raw)
  To: qemu-devel, Kevin Wolf, Coiby Xu
  Cc: peter.maydell, qemu-block, philmd, alxndr, Stefan Hajnoczi, alex.bennee

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);
+    }
+
     return qemu_storage_daemon_bin;
 }
 
-- 
2.27.0



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

* Re: [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available
  2021-08-11  9:59 [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available Thomas Huth
@ 2021-08-11 10:10 ` Alexander Bulekov
  2021-08-11 11:08 ` Peter Maydell
  1 sibling, 0 replies; 4+ messages in thread
From: Alexander Bulekov @ 2021-08-11 10:10 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Kevin Wolf, peter.maydell, qemu-block, alex.bennee, qemu-devel,
	Coiby Xu, Stefan Hajnoczi, philmd

On 210811 1159, Thomas Huth 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>

I manually removed ./storage-daemon/qemu-storage-daemon and re-ran
qos-test. The test errored-out without hanging.

Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
Tested-by: Alexander Bulekov <alxndr@bu.edu>


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

* Re: [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available
  2021-08-11  9:59 [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available Thomas Huth
  2021-08-11 10:10 ` Alexander Bulekov
@ 2021-08-11 11:08 ` Peter Maydell
  2021-10-14  6:45   ` Thomas Huth
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2021-08-11 11:08 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Kevin Wolf, Qemu-block, Alex Bennée, QEMU Developers,
	Coiby Xu, Alexander Bulekov, Stefan Hajnoczi,
	Philippe Mathieu-Daudé

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 ?

-- PMM


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

* Re: [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available
  2021-08-11 11:08 ` Peter Maydell
@ 2021-10-14  6:45   ` Thomas Huth
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2021-10-14  6:45 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Kevin Wolf, Qemu-block, Alex Bennée, QEMU Developers,
	Coiby Xu, Alexander Bulekov, Stefan Hajnoczi,
	Philippe Mathieu-Daudé

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



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

end of thread, other threads:[~2021-10-14  6:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11  9:59 [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available Thomas Huth
2021-08-11 10:10 ` Alexander Bulekov
2021-08-11 11:08 ` Peter Maydell
2021-10-14  6:45   ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.