[libvirt] [PATCH 08/18] tests: Known failing tests should never succeed

Andrea Bolognani abologna at redhat.com
Tue Aug 4 09:37:59 UTC 2015


Fix a test case that was wrongly expected to fail as well.
---
 tests/cputest.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/tests/cputest.c b/tests/cputest.c
index 06b3f12..5b7de0f 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -273,13 +273,8 @@ cpuTestGuestData(const void *arg)
     guest->match = VIR_CPU_MATCH_EXACT;
     guest->fallback = cpu->fallback;
     if (cpuDecode(guest, guestData, data->models,
-                  data->nmodels, data->preferred) < 0) {
-        if (data->result < 0) {
-            virResetLastError();
-            ret = 0;
-        }
+                  data->nmodels, data->preferred) < 0)
         goto cleanup;
-    }
 
     virBufferAsprintf(&buf, "%s+%s", data->host, data->name);
     if (data->nmodels)
@@ -302,6 +297,19 @@ cpuTestGuestData(const void *arg)
     virCPUDefFree(host);
     virCPUDefFree(cpu);
     virCPUDefFree(guest);
+
+    if (data->result < 0) {
+        virResetLastError();
+        if (ret < 0) {
+            ret = 0;
+        } else {
+            VIR_TEST_VERBOSE("\n%-70s... ",
+                             "cpuGuestData/cpuDecode was expected "
+                             "to fail but it succeeded");
+            ret = -1;
+        }
+    }
+
     return ret;
 }
 
@@ -646,7 +654,7 @@ mymain(void)
                       NULL, "Haswell-noTSX", 0);
 
     DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models, NULL, 0);
-    DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, "POWER7_v2.1", -1);
+    DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, "POWER7_v2.1", 0);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
2.4.3




More information about the libvir-list mailing list