[PATCH 2/3] tests/qtest/fdc-test: skip test cases when the 'pc' machine is missing

Christian Quante <[email protected]>
Newsgroups org.nongnu.qemu-devel
Message-ID <[email protected]>
run_isolated() starts every test case in fdc_tests[] with "-machine pc".
A QEMU built without the i440fx/pc machine fails them with "unsupported
machine type 'pc'" rather than skipping them.

Check for the machine in run_isolated() and skip there.  The previous
patch routed every table entry through that one function, so one check
covers all of them; 4e37f749dd ("tests/qtest/drive_del-test: skip pc
tests when 'pc' machine is unavailable") needed the same three lines
four times over.

The two CVE test cases are left alone.  They start QEMU without
-machine and so ask for the default machine, which is a separate
question from the one this patch answers.

Signed-off-by: Christian Quante <[email protected]>
---
 tests/qtest/fdc-test.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c
index fd38475bf7..f480f4ba09 100644
--- a/tests/qtest/fdc-test.c
+++ b/tests/qtest/fdc-test.c
@@ -690,6 +690,11 @@ static void run_isolated(const void *data)
 {
     const FDCTest *test = data;
 
+    if (!qtest_has_machine("pc")) {
+        g_test_skip("Machine 'pc' is not available");
+        return;
+    }
+
     qtest_start("-machine pc -device floppy,id=floppy0");
     qtest_irq_intercept_in(global_qtest, "ioapic");
 
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.