tests/qtest/vhost-user-blk-test: don't abort all qtests on missing envar
PATCH 1/1 tests/qtest/vhost-user-blk-test: don't abort all qtests on missing envar
This test requires environment variable QTEST_QEMU_STORAGE_DAEMON_BINARY to be defined for running. If not, it would immediately abort all qtests and prevent other, unrelated tests from running.
To fix that, just skip vhost-user-blk-test instead and log a message about missing environment variable.
---
I also tried g_test_skip(errmsg) from the setup handlers instead, but it always caused the tests to abort with an error:
../tests/qtest/libqtest.c:179: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0)
I haven't further investigated.
tests/qtest/vhost-user-blk-test.c | 6 ++++++ 1 file changed, 6 insertions(+)
tests/qtest/vhost-user-blk-test.c +6 -0
@@ -983,6 +983,12 @@ static void register_vhost_user_blk_test(void) .before = vhost_user_blk_test_setup, }; +if (!getenv ("QTEST_QEMU_STORAGE_DAEMON_BINARY" )) { +g_test_message ("QTEST_QEMU_STORAGE_DAEMON_BINARY not defined, " +"skipping vhost-user-blk-test" ); +return ; + } +/* * tests for vhost-user-blk and vhost-user-blk-pci * The tests are borrowed from tests/virtio-blk-test.c. But some tests
Signature · 1 line
2.30.2
Quoted 26 lines · Christian Schoenebeck
This test requires environment variable
QTEST_QEMU_STORAGE_DAEMON_BINARYto be defined for running. If not, it would immediately abort all qtests and prevent other, unrelated tests from running.To fix that, just skip vhost-user-blk-test instead and log a message about missing environment variable.
Signed-off-by Christian Schoenebeck <[email protected]>---
I also tried
g_test_skip(errmsg)from the setup handlers instead, but it always caused the tests to abort with an error:
../tests/qtest/libqtest.c:179:kill_qemu()tried to terminate QEMU process but encountered exit status 1 (expected 0)I haven't further investigated.
tests/qtest/vhost-user-blk-test.c | 6 ++++++ 1 file changed, 6 insertions(+)tests/qtest/vhost-user-blk-test.c +0
-0
tests/qtest/vhost-user-blk-test.c static void register_vhost_user_blk_test(void) · line 990
Quoted 8 lines
tests/qtest/vhost-user-blk-test.c +5
-0@@ -983,6 +983,12 @@ static void register_vhost_user_blk_test(void) .before = vhost_user_blk_test_setup, }; +if (!getenv ("QTEST_QEMU_STORAGE_DAEMON_BINARY" )) { +g_test_message ("QTEST_QEMU_STORAGE_DAEMON_BINARY not defined, " +"skipping vhost-user-blk-test" ); +return ; + }
Could we use g_test_skip() here?
Thomas
Thomas Huth
Reviewed-byQuoted 20 lines · Thomas Huth
Quoted 19 lines · Christian Schoenebeck
This test requires environment variable
QTEST_QEMU_STORAGE_DAEMON_BINARYto be defined for running. If not, it would immediately abort all qtests and prevent other, unrelated tests from running.To fix that, just skip vhost-user-blk-test instead and log a message about missing environment variable.
Signed-off-by Christian Schoenebeck <[email protected]>---
I also tried
g_test_skip(errmsg)from the setup handlers instead, but it always caused the tests to abort with an error:
../tests/qtest/libqtest.c:179:kill_qemu()tried to terminate QEMU process but encountered exit status 1 (expected 0)
I haven't further investigated.
tests/qtest/vhost-user-blk-test.c| 6 ++++++1 file changed, 6 insertions(+)
Quoted 14 lines
tests/qtest/vhost-user-blk-test.c static void register_vhost_user_blk_test(void) · line 989
Quoted 12 lines
tests/qtest/vhost-user-blk-test.c +5
-0@@ -983,6 +983,12 @@ static void register_vhost_user_blk_test(void) .before = vhost_user_blk_test_setup, }; + if (!getenv("QTEST_QEMU_STORAGE_DAEMON_BINARY")) { + g_test_message("QTEST_QEMU_STORAGE_DAEMON_BINARY not defined, " + "skipping vhost-user-blk-test"); + return; + }Could we use
g_test_skip()here?
Maybe I should also read the lines between "---" and "diff", sorry!
Would be interesting to know why it does not work, though, anyway, for this patch here:
Quoted 28 lines · Christian Schoenebeck
This test requires environment variable
QTEST_QEMU_STORAGE_DAEMON_BINARYto be defined for running. If not, it would immediately abort all qtests and prevent other, unrelated tests from running.To fix that, just skip vhost-user-blk-test instead and log a message about missing environment variable.
Signed-off-by Christian Schoenebeck <[email protected]>---
I also tried
g_test_skip(errmsg)from the setup handlers instead, but it always caused the tests to abort with an error:
../tests/qtest/libqtest.c:179:kill_qemu()tried to terminate QEMU process but encountered exit status 1 (expected 0)I haven't further investigated.
tests/qtest/vhost-user-blk-test.c | 6 ++++++ 1 file changed, 6 insertions(+)tests/qtest/vhost-user-blk-test.c +0
-0@@ -983,6 +983,12 @@ static void register_vhost_user_blk_test(void) .before = vhost_user_blk_test_setup, };
tests/qtest/vhost-user-blk-test.c static void register_vhost_user_blk_test(void) · line 994
Quoted 10 lines
tests/qtest/vhost-user-blk-test.c +6
-0+if (!getenv ("QTEST_QEMU_STORAGE_DAEMON_BINARY" )) { +g_test_message ("QTEST_QEMU_STORAGE_DAEMON_BINARY not defined, " +"skipping vhost-user-blk-test" ); +return ; + } +/* * tests for vhost-user-blk and vhost-user-blk-pci * The tests are borrowed from tests/virtio-blk-test.c. But some tests
Thanks, queued to my testing-next branch now:
https://gitlab.com/thuth/qemu/-/commits/testing-next/
Thomas