tests/qtest/hd-geo-test: Check for availability of "pc" machine before using it

In case QEMU has been configured with "--without-default-devices", the
"pc" machine type might be missing in the binary. We should check for
its availability before using it.

Message-ID: <20240905191434.694440-5-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Thomas Huth 2024-09-05 21:14:30 +02:00
parent 0a8ecb41fd
commit d98894d845
1 changed files with 38 additions and 33 deletions

View File

@ -1074,6 +1074,7 @@ int main(int argc, char **argv)
}
}
if (qtest_has_machine("pc")) {
qtest_add_func("hd-geo/ide/none", test_ide_none);
qtest_add_func("hd-geo/ide/drive/mbr/blank", test_ide_drive_mbr_blank);
qtest_add_func("hd-geo/ide/drive/mbr/lba", test_ide_drive_mbr_lba);
@ -1084,7 +1085,15 @@ int main(int argc, char **argv)
qtest_add_func("hd-geo/ide/device/mbr/chs", test_ide_device_mbr_chs);
qtest_add_func("hd-geo/ide/device/user/chs", test_ide_device_user_chs);
qtest_add_func("hd-geo/ide/device/user/chst", test_ide_device_user_chst);
if (have_qemu_img()) {
}
if (!have_qemu_img()) {
g_test_message("QTEST_QEMU_IMG not set or qemu-img missing; "
"skipping hd-geo/override/* tests");
goto test_add_done;
}
if (qtest_has_machine("pc")) {
qtest_add_func("hd-geo/override/ide", test_override_ide);
if (qtest_has_device("lsi53c895a")) {
qtest_add_func("hd-geo/override/scsi", test_override_scsi);
@ -1104,6 +1113,7 @@ int main(int argc, char **argv)
qtest_add_func("hd-geo/override/virtio_blk",
test_override_virtio_blk);
}
}
if (qtest_has_machine("q35")) {
qtest_add_func("hd-geo/override/sata", test_override_sata);
@ -1123,11 +1133,6 @@ int main(int argc, char **argv)
qtest_add_func("hd-geo/override/virtio_blk_q35",
test_override_virtio_blk_q35);
}
}
} else {
g_test_message("QTEST_QEMU_IMG not set or qemu-img missing; "
"skipping hd-geo/override/* tests");
}
test_add_done: