Re: [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available
On Wed, 11 Aug 2021 at 11:00, 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 > --- > 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
Re: [PATCH] storage-daemon: Add missing build dependency to the vhost-user-blk-test
On Wed, 11 Aug 2021 at 10:47, Thomas Huth wrote: > > vhost-user-blk-test needs the qemu-storage-deamon, otherwise it typo: 'daemon' > currently hangs. So make sure that we build the daemon before running > the tests. -- PMM
Re: [PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available
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 I manually removed ./storage-daemon/qemu-storage-daemon and re-ran qos-test. The test errored-out without hanging. Reviewed-by: Alexander Bulekov Tested-by: Alexander Bulekov
Re: [PATCH] storage-daemon: Add missing build dependency to the vhost-user-blk-test
On 210811 1147, Thomas Huth wrote: > vhost-user-blk-test needs the qemu-storage-deamon, otherwise it > currently hangs. So make sure that we build the daemon before running > the tests. > > Signed-off-by: Thomas Huth > --- Tested-by: Alexander Bulekov
[PATCH] tests/qtest/vhost-user-blk-test: Check whether qemu-storage-daemon is available
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 --- 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
[PATCH] storage-daemon: Add missing build dependency to the vhost-user-blk-test
vhost-user-blk-test needs the qemu-storage-deamon, otherwise it currently hangs. So make sure that we build the daemon before running the tests. Signed-off-by: Thomas Huth --- storage-daemon/meson.build | 8 tests/qtest/meson.build| 7 +-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/storage-daemon/meson.build b/storage-daemon/meson.build index 68852f3d25..49c9d2eac9 100644 --- a/storage-daemon/meson.build +++ b/storage-daemon/meson.build @@ -6,8 +6,8 @@ subdir('qapi') if have_tools qsd_ss = qsd_ss.apply(config_host, strict: false) - executable('qemu-storage-daemon', - qsd_ss.sources(), - dependencies: qsd_ss.dependencies(), - install: true) + qsd = executable('qemu-storage-daemon', + qsd_ss.sources(), + dependencies: qsd_ss.dependencies(), + install: true) endif diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index e22a0792c5..2bc3efd49f 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -276,8 +276,11 @@ foreach dir : target_dirs endif qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vmstate-daemon.sh') qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base) - qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon') - + if have_tools and have_vhost_user_blk_server +qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon') +test_deps += [qsd] + endif + foreach test : target_qtests # Executables are shared across targets, declare them only the first time we # encounter them -- 2.27.0