Rewrote the device assignment parts in tests to use qemuDomainAssignAddresses.
This way the tests will work for new device address types as they show
up in the future (like s390 device types).

Signed-off-by: Viktor Mihajlovski <mihaj...@linux.vnet.ibm.com>
---
 tests/qemuxml2argvtest.c |   12 +-----------
 tests/qemuxmlnstest.c    |   13 ++-----------
 2 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 7b00ea2..cda32b6 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -149,21 +149,11 @@ static int testCompareXMLToArgvFiles(const char *xml,
         goto out;
 
     if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) {
-        qemuDomainPCIAddressSetPtr pciaddrs;
-
-        if (qemuDomainAssignSpaprVIOAddresses(vmdef)) {
+        if (qemuDomainAssignAddresses(vmdef, extraFlags, NULL)) {
             if (expectError)
                 goto ok;
             goto out;
         }
-
-        if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef)))
-            goto out;
-
-        if (qemuAssignDevicePCISlots(vmdef, pciaddrs) < 0)
-            goto out;
-
-        qemuDomainPCIAddressSetFree(pciaddrs);
     }
 
     log = virtTestLogContentAndReset();
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 8eca466..0bc821d 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -95,17 +95,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
     if (qemudCanonicalizeMachine(&driver, vmdef) < 0)
         goto fail;
 
-    if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) {
-        qemuDomainPCIAddressSetPtr pciaddrs;
-        if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef)))
-            goto fail;
-
-        if (qemuAssignDevicePCISlots(vmdef, pciaddrs) < 0)
-            goto fail;
-
-        qemuDomainPCIAddressSetFree(pciaddrs);
-    }
-
+    if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE))
+        qemuDomainAssignAddresses(vmdef, extraFlags, NULL);
 
     log = virtTestLogContentAndReset();
     VIR_FREE(log);
-- 
1.7.0.4

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

Reply via email to