From: Denis V. Lunev <[email protected]> mkqcow2() asserts that qemu-img succeeded, so a caller that has qemu-img but cannot use it aborts the binary rather than skipping. Return the result instead. virtio-scsi-test takes the skip path it already has for a missing qemu-img; ahci-test grows one two patches on.
Cc: John Snow <[email protected]> Cc: Thomas Huth <[email protected]> Signed-off-by: Denis V. Lunev <[email protected]> --- tests/qtest/libqos/libqos.c | 4 ++-- tests/qtest/libqos/libqos.h | 2 +- tests/qtest/virtio-scsi-test.c | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/qtest/libqos/libqos.c b/tests/qtest/libqos/libqos.c index 9b49d0d4dd..ff0d595346 100644 --- a/tests/qtest/libqos/libqos.c +++ b/tests/qtest/libqos/libqos.c @@ -138,9 +138,9 @@ void migrate(QOSState *from, QOSState *to, const char *uri) migrate_allocator(&from->alloc, &to->alloc); } -void mkqcow2(const char *file, unsigned size_mb) +bool mkqcow2(const char *file, unsigned size_mb) { - g_assert_true(mkimg(file, "qcow2", size_mb)); + return mkimg(file, "qcow2", size_mb); } void prepare_blkdebug_script(const char *debug_fn, const char *event) diff --git a/tests/qtest/libqos/libqos.h b/tests/qtest/libqos/libqos.h index c04950e2b1..8390d4fa98 100644 --- a/tests/qtest/libqos/libqos.h +++ b/tests/qtest/libqos/libqos.h @@ -27,7 +27,7 @@ QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt, ...) G_GNUC_PRINTF(2, 3); void qtest_common_shutdown(QOSState *qs); void qtest_shutdown(QOSState *qs); -void mkqcow2(const char *file, unsigned size_mb); +bool mkqcow2(const char *file, unsigned size_mb); void migrate(QOSState *from, QOSState *to, const char *uri); void prepare_blkdebug_script(const char *debug_fn, const char *event); void generate_pattern(void *buffer, size_t len, size_t cycle_len); diff --git a/tests/qtest/virtio-scsi-test.c b/tests/qtest/virtio-scsi-test.c index e2350c52f6..bce6c11813 100644 --- a/tests/qtest/virtio-scsi-test.c +++ b/tests/qtest/virtio-scsi-test.c @@ -292,7 +292,10 @@ static void test_iothread_attach_node(void *obj, void *data, goto fail; } - mkqcow2(tmp_path, 64); + if (!mkqcow2(tmp_path, 64)) { + g_test_message("Could not create the qcow2 overlay"); + goto fail; + } /* Attach the overlay to the null0 node */ qtest_qmp_assert_success(scsi_pci->pci_vdev.pdev->bus->qts, -- 2.53.0
