[PATCH] tests: make domaincapstest less anoying to debug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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_REGNERATE_OUTPUT.

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

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/domaincapstest.c | 36 +++++++++++++++++++++---------------
 tests/testutilsqemu.c  |  8 ++++----
 2 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index f77accdb76..e4e13c8bb3 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -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"
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 54d6b1a0ac..34a6bd2653 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -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;
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux