[libvirt] [PATCH 1/2] tests: Add test for virtio-mmio address type

Martin Kletzander mkletzan at redhat.com
Thu Feb 26 09:30:08 UTC 2015


Commit 3e4b783e fixed an issue with RNG schema where this address type
was missing, this commit adds a test for it.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 ...=> qemuxml2argv-aarch64-aavmf-virtio-mmio.args} |  4 ++--
 ... => qemuxml2argv-aarch64-aavmf-virtio-mmio.xml} | 27 +++++++++++-----------
 tests/qemuxml2argvtest.c                           |  4 ++++
 tests/qemuxml2xmltest.c                            |  1 +
 4 files changed, 21 insertions(+), 15 deletions(-)
 copy tests/qemuxml2argvdata/{qemuxml2argv-aarch64-virt-virtio.args => qemuxml2argv-aarch64-aavmf-virtio-mmio.args} (85%)
 copy tests/qemuxml2argvdata/{qemuxml2argv-aarch64-virt-virtio.xml => qemuxml2argv-aarch64-aavmf-virtio-mmio.xml} (68%)

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args
similarity index 85%
copy from tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
copy to tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args
index d12e6e2..d6d8aed 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args
@@ -8,8 +8,8 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 -drive file=/aarch64.raw,if=none,id=drive-virtio-disk0 \
 -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \
 -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \
--net user,vlan=0,name=hostnet0 -serial pty -chardev pty,id=charconsole1 \
--device virtconsole,chardev=charconsole1,id=console1 \
+-net user,vlan=0,name=hostnet0 -chardev pty,id=charconsole0 \
+-device virtconsole,chardev=charconsole0,id=console0 \
 -device virtio-balloon-device,id=balloon0 \
 -object rng-random,id=objrng0,filename=/dev/random \
 -device virtio-rng-device,rng=objrng0,id=rng0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml
similarity index 68%
copy from tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
copy to tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml
index ad34615..4a31c8b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml
@@ -1,25 +1,26 @@
-<domain type="qemu">
+<domain type='qemu'>
   <name>aarch64test</name>
   <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
-  <memory>1048576</memory>
-  <currentMemory>1048576</currentMemory>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
   <vcpu placement='static'>1</vcpu>
   <os>
-    <type arch="aarch64" machine="virt">hvm</type>
+    <type arch='aarch64' machine='virt'>hvm</type>
     <kernel>/aarch64.kernel</kernel>
     <initrd>/aarch64.initrd</initrd>
-    <dtb>/aarch64.dtb</dtb>
     <cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
+    <dtb>/aarch64.dtb</dtb>
+    <boot dev='hd'/>
   </os>
   <features>
     <acpi/>
     <apic/>
     <pae/>
   </features>
-  <cpu match='exact'>
-    <model>cortex-a53</model>
+  <cpu mode='custom' match='exact'>
+    <model fallback='allow'>cortex-a53</model>
   </cpu>
-  <clock offset="utc"/>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>restart</on_crash>
@@ -28,19 +29,19 @@
     <disk type='file' device='disk'>
       <source file='/aarch64.raw'/>
       <target dev='vda' bus='virtio'/>
+      <address type='virtio-mmio'/>
     </disk>
+    <controller type='virtio-serial' index='0'/>
     <interface type='user'>
       <mac address='52:54:00:09:a4:37'/>
       <model type='virtio'/>
     </interface>
-    <console type='pty'/>
     <console type='pty'>
       <target type='virtio' port='0'/>
     </console>
-    <memballoon model='virtio'/>
-    <!--
-      This actually doesn't work in practice because vexpress only has
-      4 virtio slots available, rng makes 5 -->
+    <memballoon model='virtio'>
+      <address type='virtio-mmio'/>
+    </memballoon>
     <rng model='virtio'>
       <backend model='random'>/dev/random</backend>
     </rng>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 7eba5c9..c6ae48e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1508,6 +1508,10 @@ mymain(void)
             QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
             QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
+    DO_TEST("aarch64-aavmf-virtio-mmio",
+            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
+            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
+            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
     DO_TEST("aarch64-virt-default-nic",
             QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_DEVICE_VIRTIO_MMIO);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 99d4629..271d6e1 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -422,6 +422,7 @@ mymain(void)
     DO_TEST_DIFFERENT("tap-vhost-incorrect");
     DO_TEST("shmem");
     DO_TEST("smbios");
+    DO_TEST("aarch64-aavmf-virtio-mmio");

     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
-- 
2.3.0




More information about the libvir-list mailing list