[libvirt] [PATCH 2/3] tests: invert the return logic in storagepoolcapstest

Pavel Hrdina phrdina at redhat.com
Wed Mar 6 18:16:47 UTC 2019


This way if the first test "full" fails we will run the second test as
well.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 tests/storagepoolcapstest.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/storagepoolcapstest.c b/tests/storagepoolcapstest.c
index ade586bcdd..da21bca546 100644
--- a/tests/storagepoolcapstest.c
+++ b/tests/storagepoolcapstest.c
@@ -85,7 +85,7 @@ test_virStoragePoolCapsFormat(const void *opaque)
 static int
 mymain(void)
 {
-    int ret = -1;
+    int ret = 0;
     virCapsPtr fullCaps = NULL;
     virCapsPtr fsCaps = NULL;
 
@@ -94,12 +94,14 @@ mymain(void)
         struct test_virStoragePoolCapsFormatData data = \
             {.filename = Filename, .driverCaps = DriverCaps }; \
         if (virTestRun(Filename, test_virStoragePoolCapsFormat, &data) < 0) \
-            goto cleanup; \
+            ret = -1; \
     } while (0)
 
     if (!(fullCaps = virCapabilitiesNew(VIR_ARCH_NONE, false, false)) ||
-        !(fsCaps = virCapabilitiesNew(VIR_ARCH_NONE, false, false)))
+        !(fsCaps = virCapabilitiesNew(VIR_ARCH_NONE, false, false))) {
+        ret = -1;
         goto cleanup;
+    }
 
     test_virCapabilitiesAddFullStoragePool(fullCaps);
     test_virCapabilitiesAddFSStoragePool(fsCaps);
@@ -107,8 +109,6 @@ mymain(void)
     DO_TEST("full", fullCaps);
     DO_TEST("fs", fsCaps);
 
-    ret = 0;
-
  cleanup:
     virObjectUnref(fullCaps);
     virObjectUnref(fsCaps);
-- 
2.20.1




More information about the libvir-list mailing list