]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuxml2argvtest: Avoid conditions in test macro
authorPeter Krempa <pkrempa@redhat.com>
Tue, 17 Aug 2021 14:35:20 +0000 (16:35 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 18 Aug 2021 08:20:49 +0000 (10:20 +0200)
Pass a pointer to the 'ret' variable to the test executor itself and
update it there to improve compile times of the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemustatusxml2xmltest.c
tests/qemuxml2argvtest.c
tests/qemuxml2xmltest.c
tests/testutilsqemu.h

index d58f4b69dab8942cbfbcf6033abec0167b469125..f6bde507a15cafe422e5a1263b277b7b72d47bad 100644 (file)
@@ -83,7 +83,8 @@ mymain(void)
     g_autoptr(virConnect) conn = NULL;
     struct testQemuConf testConf = { .capslatest = capslatest,
                                      .capscache = capscache,
-                                     .qapiSchemaCache = NULL };
+                                     .qapiSchemaCache = NULL,
+                                     .retptr = NULL };
 
     if (!capslatest)
         return EXIT_FAILURE;
index 2f7e088fd04093766b7ac02cc6dd5c879c93b96e..4ce7ed5f002b66edb2359f06105e717229df8aee 100644 (file)
@@ -826,6 +826,9 @@ testCompareXMLToArgv(const void *data)
     if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64)
         qemuTestSetHostArch(&driver, VIR_ARCH_NONE);
 
+    if (ret < 0)
+        *info->conf->retptr = ret;
+
     return ret;
 }
 
@@ -853,7 +856,8 @@ mymain(void)
     g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData);
     struct testQemuConf testConf = { .capslatest = capslatest,
                                      .capscache = capscache,
-                                     .qapiSchemaCache = qapiSchemaCache };
+                                     .qapiSchemaCache = qapiSchemaCache,
+                                     .retptr = &ret };
 
     if (!capslatest)
         return EXIT_FAILURE;
@@ -948,9 +952,7 @@ mymain(void)
         }; \
         testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
         testInfoSetPaths(&info, _suffix); \
-        if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
-                       testCompareXMLToArgv, &info) < 0) \
-            ret = -1; \
+        virTestRun("QEMU XML-2-ARGV " _name _suffix, testCompareXMLToArgv, &info); \
         testQemuInfoClear(&info); \
     } while (0)
 
index 92fab7d1694193a0ccf4a643175f07b0961a49bd..f6a38d7716a7a1982f6df93c6d69b8cecf390adb 100644 (file)
@@ -112,7 +112,8 @@ mymain(void)
     g_autoptr(virConnect) conn = NULL;
     struct testQemuConf testConf = { .capslatest = capslatest,
                                      .capscache = capscache,
-                                     .qapiSchemaCache = NULL };
+                                     .qapiSchemaCache = NULL,
+                                     .retptr = NULL };
 
     if (!capslatest)
         return EXIT_FAILURE;
index d59fa5323986264dd7dc04d0174b78d3d9ec8424..64562cbd1c772bf93363dbdb5b8800f300e12384 100644 (file)
@@ -58,6 +58,7 @@ struct testQemuConf {
     GHashTable *capscache;
     GHashTable *capslatest;
     GHashTable *qapiSchemaCache;
+    int *retptr;
 };
 
 struct testQemuArgs {