OSDN Git Service

tests/qtest: Improve endianness-test to work with missing machines and devices
authorThomas Huth <thuth@redhat.com>
Mon, 20 Dec 2021 08:10:52 +0000 (09:10 +0100)
committerThomas Huth <thuth@redhat.com>
Wed, 22 Dec 2021 07:13:05 +0000 (08:13 +0100)
The users might have built QEMU with less machines or without the
i82378 superio device. Add some checks to the endianess-test so that
it is able to deal with such stripped down QEMU versions, too.

Message-Id: <20211220081054.151515-3-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/qtest/endianness-test.c

index 09ecb53..9c03b72 100644 (file)
@@ -281,7 +281,10 @@ int main(int argc, char **argv)
 
     for (i = 0; test_cases[i].arch; i++) {
         gchar *path;
-        if (strcmp(test_cases[i].arch, arch) != 0) {
+
+        if (!g_str_equal(test_cases[i].arch, arch) ||
+            !qtest_has_machine(test_cases[i].machine) ||
+            (test_cases[i].superio && !qtest_has_device(test_cases[i].superio))) {
             continue;
         }
         path = g_strdup_printf("endianness/%s",