diff mbox series

[v2,3/4] tests: qemuxml2argv: report error on ARG_* collisions

Message ID 18de67cff7d62c950885a42f98c3d646579fa432.1553197802.git.crobinso@redhat.com
State Accepted
Commit 6fa656384ee59f92cd96ef3c2bb23f4e40360b38
Headers show
Series tests: qemuxml2argv: support optional arguments | expand

Commit Message

Cole Robinson March 21, 2019, 7:55 p.m. UTC
* ARG_CAPS_ARCH must be specified with ARG_CAPS_VER
* ARG_QEMU_CAPS shouldn't be specified with ARG_CAPS_*

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 tests/qemuxml2argvtest.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

-- 
2.21.0

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

Comments

Andrea Bolognani March 22, 2019, 9:20 a.m. UTC | #1
On Thu, 2019-03-21 at 15:55 -0400, Cole Robinson wrote:
> * ARG_CAPS_ARCH must be specified with ARG_CAPS_VER

> * ARG_QEMU_CAPS shouldn't be specified with ARG_CAPS_*

> 

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---

>  tests/qemuxml2argvtest.c | 12 ++++++++++++

>  1 file changed, 12 insertions(+)


Reviewed-by: Andrea Bolognani <abologna@redhat.com>


-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 191a43726d..34394181c1 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -688,6 +688,18 @@  testInfoSetArgs(struct testInfo *info,
         }
     }
 
+    if (!!capsarch ^ !!capsver) {
+        fprintf(stderr, "ARG_CAPS_ARCH and ARG_CAPS_VER "
+                        "must be specified together.\n");
+        goto cleanup;
+    }
+
+    if (qemuCaps && (capsarch || capsver)) {
+        fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH "
+                        "or ARG_CAPS_VER\n");
+        goto cleanup;
+    }
+
     if (!qemuCaps && capsarch && capsver) {
         bool stripmachinealiases = false;