]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: make domaincapstest less anoying to debug
authorPeter Krempa <pkrempa@redhat.com>
Fri, 25 Oct 2019 11:59:46 +0000 (13:59 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 11 Nov 2019 15:46:40 +0000 (16:46 +0100)
Since 6a077cf2b3 domaincapstest does not run through all cases on
failure but terminates right away. This makes it super annoying to debug
or use in combination with VIR_TEST_REGENERATE_OUTPUT.

Fix it by remembering failure and still running through all cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
tests/domaincapstest.c
tests/testutilsqemu.c

index f77accdb761c0ec21ead03193e04f0c5c8215256..e4e13c8bb384c99cd48f768417eea8fa41a4de10 100644 (file)
@@ -313,6 +313,8 @@ doTestQemu(const char *inputDir G_GNUC_UNUSED,
            const char *suffix G_GNUC_UNUSED,
            void *opaque)
 {
+    int ret = 0;
+
     if (STREQ(arch, "x86_64")) {
         /* For x86_64 we test three combinations:
          *
@@ -321,13 +323,16 @@ doTestQemu(const char *inputDir G_GNUC_UNUSED,
          *   - TCG with default machine
          */
         if (doTestQemuInternal(version, NULL, arch,
-                               VIR_DOMAIN_VIRT_KVM, opaque) < 0 ||
-            doTestQemuInternal(version, "q35", arch,
-                               VIR_DOMAIN_VIRT_KVM, opaque) < 0 ||
-            doTestQemuInternal(version, NULL, arch,
-                               VIR_DOMAIN_VIRT_QEMU, opaque) < 0) {
-            return -1;
-        }
+                               VIR_DOMAIN_VIRT_KVM, opaque) < 0)
+            ret = -1;
+
+        if (doTestQemuInternal(version, "q35", arch,
+                               VIR_DOMAIN_VIRT_KVM, opaque) < 0)
+            ret = -1;
+
+        if (doTestQemuInternal(version, NULL, arch,
+                               VIR_DOMAIN_VIRT_QEMU, opaque) < 0)
+            ret = -1;
     } else if (STREQ(arch, "aarch64")) {
         /* For aarch64 we test two combinations:
          *
@@ -335,21 +340,22 @@ doTestQemu(const char *inputDir G_GNUC_UNUSED,
          *   - KVM with virt machine
          */
         if (doTestQemuInternal(version, NULL, arch,
-                               VIR_DOMAIN_VIRT_KVM, opaque) < 0 ||
-            doTestQemuInternal(version, "virt", arch,
-                               VIR_DOMAIN_VIRT_KVM, opaque) < 0) {
-            return -1;
-        }
+                               VIR_DOMAIN_VIRT_KVM, opaque) < 0)
+            ret = -1;
+
+        if (doTestQemuInternal(version, "virt", arch,
+                               VIR_DOMAIN_VIRT_KVM, opaque) < 0)
+            ret = -1;
     } else if (STRPREFIX(arch, "riscv")) {
         /* Unfortunately we have to skip RISC-V at the moment */
         return 0;
     } else {
         if (doTestQemuInternal(version, NULL, arch,
                                VIR_DOMAIN_VIRT_KVM, opaque) < 0)
-            return -1;
+            ret = -1;
     }
 
-    return 0;
+    return ret;
 }
 
 #endif
@@ -431,7 +437,7 @@ mymain(void)
                             abs_srcdir "/qemufirmwaredata/home/user/.config/qemu/firmware");
 
     if (testQemuCapsIterate(".xml", doTestQemu, cfg) < 0)
-        return EXIT_FAILURE;
+        ret = -1;
 
     /*
      * Run "tests/qemucapsprobe /path/to/qemu/binary >foo.replies"
index 54d6b1a0ac6d758893b24d2289276dd0619a5887..34a6bd2653cf00999068f238a8063482f8aa3a40 100644 (file)
@@ -902,6 +902,7 @@ testQemuCapsIterate(const char *suffix,
     DIR *dir = NULL;
     int rc;
     int ret = -1;
+    bool fail = false;
 
     if (!callback)
         return 0;
@@ -949,12 +950,11 @@ testQemuCapsIterate(const char *suffix,
          * the callback.
          */
         if (callback(TEST_QEMU_CAPS_PATH, "caps", version,
-                     archName, suffix + 1, opaque) < 0) {
-            goto cleanup;
-        }
+                     archName, suffix + 1, opaque) < 0)
+            fail = true;
     }
 
-    if (rc < 0)
+    if (rc < 0 || fail)
         goto cleanup;
 
     ret = 0;