diff mbox

[v2,6/6] tests: qemu: More aarch64 virtio and pci tests

Message ID f7efa1e5f962401a474280b7a1e37ed6aec3f888.1455032128.git.crobinso@redhat.com
State Accepted
Commit 5a1ccaeb00d3cba7727b7022587f77b4fd2edd2b
Headers show

Commit Message

Cole Robinson Feb. 9, 2016, 3:59 p.m. UTC
Clarify the point of some of the test cases by renaming them. Add more
xml2xml tests.
---
 ...> qemuxml2argv-aarch64-virtio-pci-default.args} |  0
 ...=> qemuxml2argv-aarch64-virtio-pci-default.xml} |  0
 ...2argv-aarch64-virtio-pci-manual-addresses.args} |  0
 ...l2argv-aarch64-virtio-pci-manual-addresses.xml} |  0
 tests/qemuxml2argvtest.c                           | 11 +++-
 .../qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml   |  6 +-
 .../qemuxml2xmlout-aarch64-virtio-pci-default.xml  | 69 ++++++++++++++++++++++
 ...2xmlout-aarch64-virtio-pci-manual-addresses.xml | 53 +++++++++++++++++
 tests/qemuxml2xmltest.c                            | 17 +++++-
 9 files changed, 152 insertions(+), 4 deletions(-)
 rename tests/qemuxml2argvdata/{qemuxml2argv-aarch64-mmio-default-pci.args => qemuxml2argv-aarch64-virtio-pci-default.args} (100%)
 rename tests/qemuxml2argvdata/{qemuxml2argv-aarch64-mmio-default-pci.xml => qemuxml2argv-aarch64-virtio-pci-default.xml} (100%)
 rename tests/qemuxml2argvdata/{qemuxml2argv-aarch64-virtio-pci.args => qemuxml2argv-aarch64-virtio-pci-manual-addresses.args} (100%)
 rename tests/qemuxml2argvdata/{qemuxml2argv-aarch64-virtio-pci.xml => qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml} (100%)
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml

-- 
2.5.0

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

Comments

Cole Robinson Feb. 9, 2016, 9:15 p.m. UTC | #1
On 02/09/2016 03:50 PM, Laine Stump wrote:
> On 02/09/2016 10:59 AM, Cole Robinson wrote:

>> Clarify the point of some of the test cases by renaming them. Add more

>> xml2xml tests.

>> ---

>>   ...> qemuxml2argv-aarch64-virtio-pci-default.args} |  0

>>   ...=> qemuxml2argv-aarch64-virtio-pci-default.xml} |  0

>>   ...2argv-aarch64-virtio-pci-manual-addresses.args} |  0

>>   ...l2argv-aarch64-virtio-pci-manual-addresses.xml} |  0

>>   tests/qemuxml2argvtest.c                           | 11 +++-

>>   .../qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml   |  6 +-

>>   .../qemuxml2xmlout-aarch64-virtio-pci-default.xml  | 69

>> ++++++++++++++++++++++

>>   ...2xmlout-aarch64-virtio-pci-manual-addresses.xml | 53 +++++++++++++++++

>>   tests/qemuxml2xmltest.c                            | 17 +++++-

>>   9 files changed, 152 insertions(+), 4 deletions(-)

>>   rename tests/qemuxml2argvdata/{qemuxml2argv-aarch64-mmio-default-pci.args

>> => qemuxml2argv-aarch64-virtio-pci-default.args} (100%)

>>   rename tests/qemuxml2argvdata/{qemuxml2argv-aarch64-mmio-default-pci.xml

>> => qemuxml2argv-aarch64-virtio-pci-default.xml} (100%)

>>   rename tests/qemuxml2argvdata/{qemuxml2argv-aarch64-virtio-pci.args =>

>> qemuxml2argv-aarch64-virtio-pci-manual-addresses.args} (100%)

>>   rename tests/qemuxml2argvdata/{qemuxml2argv-aarch64-virtio-pci.xml =>

>> qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml} (100%)

>>   create mode 100644

>> tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml

>>   create mode 100644

>> tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml

>>

>> diff --git

>> a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-mmio-default-pci.args

>> b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args

>> similarity index 100%

>> rename from tests/qemuxml2argvdata/qemuxml2argv-aarch64-mmio-default-pci.args

>> rename to tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args

>> diff --git

>> a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-mmio-default-pci.xml

>> b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml

>> similarity index 100%

>> rename from tests/qemuxml2argvdata/qemuxml2argv-aarch64-mmio-default-pci.xml

>> rename to tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml

>> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci.args

>> b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args

>> similarity index 100%

>> rename from tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci.args

>> rename to

>> tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args

>> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci.xml

>> b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml

>> similarity index 100%

>> rename from tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci.xml

>> rename to

>> tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml

> 

> I'll take your word that the new names are more proper :-)

> 

>> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c

>> index 92043d2..3c7693b 100644

>> --- a/tests/qemuxml2argvtest.c

>> +++ b/tests/qemuxml2argvtest.c

>> @@ -1650,13 +1650,20 @@ mymain(void)

>>               QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,

>>               QEMU_CAPS_DEVICE_VIRTIO_MMIO,

>>               QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);

>> -    DO_TEST("aarch64-mmio-default-pci",

>> +

>> +    /* Demonstrates the virtio-pci default... namely that there isn't any!

>> +       q35 style PCI controllers will be added if the binary supports it,

> 

> This reminds me that the code that was originally intended only for Q35 will

> automatically add a dmi-to-pci-bridge and a pci-bridge in addition to the

> pcie-root. While these other controllers are apparently supported on arm too,

> an email exchange awhile back with [somebody, I forget who] pointed out this

> isn't really necessary, so I wonder if we really want it that way (again, this

> is code in qemuDomainDefAddDefaultDevices()) - maybe arm only wants to add

> pcie-root but not the others (of course we would also need to make the slot

> assignment code allow auto-assigning to pcie-root, or maybe put in a

> pcie-switch-upstream-port and a collection of pcie-switch-downstream-ports as

> necessary (similar to how we automatically add pci-bridges as necessary today).

> 

> But that is of course *not* the subject of this patch (although doing what I

> describe will add churn to the files being touched here), so I mention it only

> in passing.

> 


Please check out this series:

https://www.redhat.com/archives/libvir-list/2016-January/msg01244.html

That's dealing with exactly that situation. I could use a bit of PCI related
advice actually, because what I'd like to use for default XML doesn't
currently fly with qemu_command's PCI expectations.

> 

> I like the added comments describing what is being tested! That should be done

> more often! (either in the .c file, or maybe we could add some metadata to the

> xml test files describing what's being tested. That might prevent someone from

> unknowingly removing some important bit of a test case some day).

> 

> ACK

> 

> 


Thanks, pushed now

- Cole

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

Patch

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-mmio-default-pci.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args
similarity index 100%
rename from tests/qemuxml2argvdata/qemuxml2argv-aarch64-mmio-default-pci.args
rename to tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-mmio-default-pci.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml
similarity index 100%
rename from tests/qemuxml2argvdata/qemuxml2argv-aarch64-mmio-default-pci.xml
rename to tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args
similarity index 100%
rename from tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci.args
rename to tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml
similarity index 100%
rename from tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci.xml
rename to tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 92043d2..3c7693b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1650,13 +1650,20 @@  mymain(void)
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
             QEMU_CAPS_DEVICE_VIRTIO_MMIO,
             QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
-    DO_TEST("aarch64-mmio-default-pci",
+
+    /* Demonstrates the virtio-pci default... namely that there isn't any!
+       q35 style PCI controllers will be added if the binary supports it,
+       but virtio-mmio is always used unless PCI addresses are manually
+       specified. */
+    DO_TEST("aarch64-virtio-pci-default",
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
             QEMU_CAPS_DEVICE_VIRTIO_MMIO,
             QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
             QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE);
-    DO_TEST("aarch64-virtio-pci",
+    /* Example of using virtio-pci with no explicit PCI controller
+       but with manual PCI addresses */
+    DO_TEST("aarch64-virtio-pci-manual-addresses",
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
             QEMU_CAPS_DEVICE_VIRTIO_MMIO,
             QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml
index 4a31c8b..f79c6e7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml
@@ -31,10 +31,13 @@ 
       <target dev='vda' bus='virtio'/>
       <address type='virtio-mmio'/>
     </disk>
-    <controller type='virtio-serial' index='0'/>
+    <controller type='virtio-serial' index='0'>
+      <address type='virtio-mmio'/>
+    </controller>
     <interface type='user'>
       <mac address='52:54:00:09:a4:37'/>
       <model type='virtio'/>
+      <address type='virtio-mmio'/>
     </interface>
     <console type='pty'>
       <target type='virtio' port='0'/>
@@ -44,6 +47,7 @@ 
     </memballoon>
     <rng model='virtio'>
       <backend model='random'>/dev/random</backend>
+      <address type='virtio-mmio'/>
     </rng>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml
new file mode 100644
index 0000000..6f1c53b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml
@@ -0,0 +1,69 @@ 
+<domain type='qemu'>
+  <name>aarch64test</name>
+  <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+    <kernel>/aarch64.kernel</kernel>
+    <initrd>/aarch64.initrd</initrd>
+    <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 mode='custom' match='exact'>
+    <model fallback='allow'>cortex-a53</model>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <disk type='file' device='disk'>
+      <source file='/aarch64.raw'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='virtio-mmio'/>
+    </disk>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='virtio-serial' index='0'>
+      <address type='virtio-mmio'/>
+    </controller>
+    <interface type='user'>
+      <mac address='52:54:00:09:a4:37'/>
+      <model type='virtio'/>
+      <address type='virtio-mmio'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <console type='pty'>
+      <target type='virtio' port='1'/>
+    </console>
+    <memballoon model='virtio'>
+      <address type='virtio-mmio'/>
+    </memballoon>
+    <rng model='virtio'>
+      <backend model='random'>/dev/random</backend>
+      <address type='virtio-mmio'/>
+    </rng>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml
new file mode 100644
index 0000000..4add271
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml
@@ -0,0 +1,53 @@ 
+<domain type='qemu'>
+  <name>aarch64test</name>
+  <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+    <kernel>/aarch64.kernel</kernel>
+    <initrd>/aarch64.initrd</initrd>
+    <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 mode='custom' match='exact'>
+    <model fallback='allow'>cortex-a53</model>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <disk type='file' device='disk'>
+      <source file='/aarch64.raw'/>
+      <target dev='sda' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
+    <interface type='user'>
+      <mac address='52:54:00:09:a4:37'/>
+      <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </interface>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index a06aa4d..8c71e9b 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -720,8 +720,23 @@  mymain(void)
     DO_TEST("shmem");
     DO_TEST("smbios");
     DO_TEST("smbios-multiple-type2");
-    DO_TEST("aarch64-aavmf-virtio-mmio");
 
+    DO_TEST_FULL("aarch64-aavmf-virtio-mmio", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
+            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
+            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
+    DO_TEST_FULL("aarch64-virtio-pci-default", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
+            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
+            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
+            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_VIRTIO_SCSI);
+    DO_TEST_FULL("aarch64-virtio-pci-manual-addresses", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
+            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
+            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
+            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_VIRTIO_SCSI);
     DO_TEST("aarch64-gic");
     DO_TEST("aarch64-gicv3");