tests/qtest: Add missing checks for the availability of machines
PATCH 1/1 tests/qtest: Add missing checks for the availability of machines
From: Thomas Huth <[email protected]>
When QEMU has been compiled with "--without-default-devices", the machines might not be available in the binary. Let's properly check for the machines before running the tests to avoid that they are failing in this case.
Signed-off-by Thomas Huth <[email protected]>
--- tests/qtest/bios-tables-test.c | 2 +- tests/qtest/cpu-plug-test.c | 2 +- tests/qtest/riscv-csr-test.c | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-)
tests/qtest/bios-tables-test.c +1 -1
@@ -2864,7 +2864,7 @@ int main(int argc, char *argv[]) test_acpi_riscv64_virt_tcg_acpi_spcr); } }else if (strcmp (arch,"loongarch64" ) ==0 ) { -if (has_tcg) { +if (has_tcg &&qtest_has_machine ("virt" )) {qtest_add_func ("acpi/virt" , test_acpi_loongarch64_virt);qtest_add_func ("acpi/virt/topology" , test_acpi_loongarch64_virt_topology);
tests/qtest/cpu-plug-test.c +1 -1
@@ -190,7 +190,7 @@ int main(int argc, char **argv)qtest_cb_for_every_machine (add_pseries_test_case,g_test_quick ()); }else if (g_str_equal (arch,"s390x" )) {qtest_cb_for_every_machine (add_s390x_test_case,g_test_quick ()); - }else if (g_str_equal (arch,"loongarch64" )) { + }else if (g_str_equal (arch,"loongarch64" ) &&qtest_has_machine ("virt" )) {add_loongarch_test_case ("virt" ); }
tests/qtest/riscv-csr-test.c +3 -1
@@ -50,7 +50,9 @@ int main(int argc, char **argv) {g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/cpu/csr" , run_test_csr); +if (qtest_has_machine ("virt" )) { +qtest_add_func ("/cpu/csr" , run_test_csr); + }return g_test_run (); }
Signature · 1 line
2.51.0
Quoted 8 lines · Thomas Huth
From: Thomas Huth <[email protected]>
When QEMU has been compiled with "--without-default-devices", the machines might not be available in the binary. Let's properly check for the machines before running the tests to avoid that they are failing in this case.
Signed-off-by Thomas Huth <[email protected]>
Reviewed-by Fabiano Rosas <[email protected]>