]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: qemuxml2argv: fail also on unexpected pass
authorPino Toscano <ptoscano@redhat.com>
Thu, 7 Sep 2017 12:19:37 +0000 (14:19 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 21 Sep 2017 11:05:14 +0000 (13:05 +0200)
If a test expects either a parse error or a failure but then there is
neither a parse error nor a failure, then properly mark the test as
failing, instead of failing later on (e.g. trying to open a
non-existing .args file).

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
tests/qemuxml2argvtest.c

index 350a0ab121050dee73228286697abed3d52ca6b2..c85f3a3cdb974c6cb523ab526d027c047349a01f 100644 (file)
@@ -463,6 +463,10 @@ testCompareXMLToArgv(const void *data)
             goto ok;
         goto cleanup;
     }
+    if (flags & FLAG_EXPECT_PARSE_ERROR) {
+        VIR_TEST_DEBUG("passed instead of expected parse error");
+        goto cleanup;
+    }
     priv = vm->privateData;
 
     if (virBitmapParse("0-3", &priv->autoNodeset, 4) < 0)
@@ -502,6 +506,10 @@ testCompareXMLToArgv(const void *data)
             goto ok;
         goto cleanup;
     }
+    if (flags & FLAG_EXPECT_FAILURE) {
+        VIR_TEST_DEBUG("passed instead of expected failure");
+        goto cleanup;
+    }
 
     if (!(actualargv = virCommandToString(cmd)))
         goto cleanup;