From b063c290f3d28a3142e90a1717b26b55ec1a7d17 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 11 Aug 2021 11:59:49 +0200 Subject: 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. Message-Id: <20210811095949.133462-1-thuth@redhat.com> Reviewed-by: Alexander Bulekov Tested-by: Alexander Bulekov Signed-off-by: Thomas Huth --- tests/qtest/vhost-user-blk-test.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/qtest') diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c index 8796c74..6f108a1 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; } -- cgit v1.1