[libvirt] [PATCHv2 1/7] tests: add a function for checking exclusive flags

Ján Tomko jtomko at redhat.com
Wed Sep 12 13:30:47 UTC 2018


We can reject some non-sensical combinations with an error
message, once we add flags for them.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 tests/qemuxml2argvtest.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 816a3055a2..65fab6c077 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -465,6 +465,18 @@ testCompareXMLToStartupXML(const void *data)
 }
 
 
+static int
+testCheckExclusiveFlags(int flags)
+{
+    virCheckFlags(FLAG_EXPECT_FAILURE |
+                  FLAG_EXPECT_PARSE_ERROR |
+                  FLAG_FIPS |
+                  0, -1);
+
+    return 0;
+}
+
+
 static int
 testCompareXMLToArgv(const void *data)
 {
@@ -507,6 +519,9 @@ testCompareXMLToArgv(const void *data)
     if (virQEMUCapsGet(info->qemuCaps, QEMU_CAPS_ENABLE_FIPS))
         flags |= FLAG_FIPS;
 
+    if (testCheckExclusiveFlags(info->flags) < 0)
+        goto cleanup;
+
     if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0)
         goto cleanup;
 
-- 
2.16.4




More information about the libvir-list mailing list