[libvirt] [PATCH v3 4/4] qemu: added tests of the new default video type selection algorithm

Pavel Mores pmores at redhat.com
Mon Nov 25 10:54:26 UTC 2019


The test case for x86_64 and neither cirrus nor vga capability is of the
xml2argv type because it actually fails to parse the XML at all [*] which
is something that xml2xml tests don't seem to handle.  xml2argv test fails
to produce a qemu argv for this case which xml2argv tests can handle.

[*] This is a consequence of the decision not to have a fallback if the
obvious choices (cirrus and vga) aren't viable due to missing QEMU caps.

Signed-off-by: Pavel Mores <pmores at redhat.com>
---
 .../default-video-type-aarch64.xml            | 16 +++++++
 .../default-video-type-ppc64.xml              | 16 +++++++
 .../default-video-type-riscv64.xml            | 16 +++++++
 .../default-video-type-s390x.xml              | 16 +++++++
 .../default-video-type-x86_64-caps-test-0.xml | 17 ++++++++
 .../default-video-type-x86_64-caps-test-1.xml | 17 ++++++++
 tests/qemuxml2argvtest.c                      |  1 +
 ...ault-video-type-aarch64.aarch64-latest.xml | 42 +++++++++++++++++++
 .../default-video-type-ppc64.ppc64-latest.xml | 31 ++++++++++++++
 ...ault-video-type-riscv64.riscv64-latest.xml | 39 +++++++++++++++++
 .../default-video-type-s390x.s390x-latest.xml | 32 ++++++++++++++
 .../default-video-type-x86_64-caps-test-0.xml | 31 ++++++++++++++
 .../default-video-type-x86_64-caps-test-1.xml | 31 ++++++++++++++
 tests/qemuxml2xmltest.c                       |  7 ++++
 14 files changed, 312 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/default-video-type-aarch64.xml
 create mode 100644 tests/qemuxml2argvdata/default-video-type-ppc64.xml
 create mode 100644 tests/qemuxml2argvdata/default-video-type-riscv64.xml
 create mode 100644 tests/qemuxml2argvdata/default-video-type-s390x.xml
 create mode 100644 tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.xml
 create mode 100644 tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.xml
 create mode 100644 tests/qemuxml2xmloutdata/default-video-type-aarch64.aarch64-latest.xml
 create mode 100644 tests/qemuxml2xmloutdata/default-video-type-ppc64.ppc64-latest.xml
 create mode 100644 tests/qemuxml2xmloutdata/default-video-type-riscv64.riscv64-latest.xml
 create mode 100644 tests/qemuxml2xmloutdata/default-video-type-s390x.s390x-latest.xml
 create mode 100644 tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-0.xml
 create mode 100644 tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-1.xml

diff --git a/tests/qemuxml2argvdata/default-video-type-aarch64.xml b/tests/qemuxml2argvdata/default-video-type-aarch64.xml
new file mode 100644
index 0000000000..03326d3c9b
--- /dev/null
+++ b/tests/qemuxml2argvdata/default-video-type-aarch64.xml
@@ -0,0 +1,16 @@
+<domain type='kvm'>
+  <name>default-video-type-aarch64-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+  </os>
+  <cpu mode='host-passthrough'/>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <memballoon model='none'/>
+    <graphics type='spice'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/default-video-type-ppc64.xml b/tests/qemuxml2argvdata/default-video-type-ppc64.xml
new file mode 100644
index 0000000000..739e07fc19
--- /dev/null
+++ b/tests/qemuxml2argvdata/default-video-type-ppc64.xml
@@ -0,0 +1,16 @@
+<domain type='kvm'>
+  <name>default-video-type-ppc64-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='virt'>hvm</type>
+  </os>
+  <cpu mode='host-passthrough'/>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <memballoon model='none'/>
+    <graphics type='spice'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/default-video-type-riscv64.xml b/tests/qemuxml2argvdata/default-video-type-riscv64.xml
new file mode 100644
index 0000000000..55f6fa9391
--- /dev/null
+++ b/tests/qemuxml2argvdata/default-video-type-riscv64.xml
@@ -0,0 +1,16 @@
+<domain type='qemu'>
+  <name>default-video-type-riscv64-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='riscv64' machine='virt'>hvm</type>
+  </os>
+  <cpu mode='host-passthrough'/>
+  <devices>
+    <emulator>/usr/bin/qemu-system-riscv64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <memballoon model='none'/>
+    <graphics type='spice'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/default-video-type-s390x.xml b/tests/qemuxml2argvdata/default-video-type-s390x.xml
new file mode 100644
index 0000000000..9eda06a3a1
--- /dev/null
+++ b/tests/qemuxml2argvdata/default-video-type-s390x.xml
@@ -0,0 +1,16 @@
+<domain type='kvm'>
+  <name>default-video-type-s390x-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='virt'>hvm</type>
+  </os>
+  <cpu mode='host-passthrough'/>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <memballoon model='none'/>
+    <graphics type='spice'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.xml b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.xml
new file mode 100644
index 0000000000..2c753fe227
--- /dev/null
+++ b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.xml
@@ -0,0 +1,17 @@
+<domain type='kvm'>
+  <name>default-video-type-x86_64-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='virt'>hvm</type>
+  </os>
+  <cpu mode='host-passthrough'/>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='none'/>
+    <graphics type='spice'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.xml b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.xml
new file mode 100644
index 0000000000..2c753fe227
--- /dev/null
+++ b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.xml
@@ -0,0 +1,17 @@
+<domain type='kvm'>
+  <name>default-video-type-x86_64-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='virt'>hvm</type>
+  </os>
+  <cpu mode='host-passthrough'/>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='none'/>
+    <graphics type='spice'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 07e711840d..a2791d0460 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2059,6 +2059,7 @@ mymain(void)
     DO_TEST("video-none-device",
             QEMU_CAPS_VNC);
     DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE);
+    DO_TEST_PARSE_ERROR("default-video-type-x86_64-caps-test-0", NONE);
 
     DO_TEST("virtio-rng-default",
             QEMU_CAPS_DEVICE_VIRTIO_RNG,
diff --git a/tests/qemuxml2xmloutdata/default-video-type-aarch64.aarch64-latest.xml b/tests/qemuxml2xmloutdata/default-video-type-aarch64.aarch64-latest.xml
new file mode 100644
index 0000000000..4b660b8d70
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/default-video-type-aarch64.aarch64-latest.xml
@@ -0,0 +1,42 @@
+<domain type='kvm'>
+  <name>default-video-type-aarch64-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <gic version='3'/>
+  </features>
+  <cpu mode='host-passthrough' check='none'/>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+      <target chassis='1' port='0x8'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
+    </controller>
+    <controller type='pci' index='2' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+      <target chassis='2' port='0x9'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <graphics type='spice'>
+      <listen type='none'/>
+    </graphics>
+    <video>
+      <model type='virtio' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/default-video-type-ppc64.ppc64-latest.xml b/tests/qemuxml2xmloutdata/default-video-type-ppc64.ppc64-latest.xml
new file mode 100644
index 0000000000..590a73b456
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/default-video-type-ppc64.ppc64-latest.xml
@@ -0,0 +1,31 @@
+<domain type='kvm'>
+  <name>default-video-type-ppc64-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='virt'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='host-passthrough' check='none'/>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='keyboard' bus='usb'/>
+    <input type='mouse' bus='usb'/>
+    <graphics type='spice'>
+      <listen type='none'/>
+    </graphics>
+    <video>
+      <model type='vga' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/default-video-type-riscv64.riscv64-latest.xml b/tests/qemuxml2xmloutdata/default-video-type-riscv64.riscv64-latest.xml
new file mode 100644
index 0000000000..ebb3bfe980
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/default-video-type-riscv64.riscv64-latest.xml
@@ -0,0 +1,39 @@
+<domain type='qemu'>
+  <name>default-video-type-riscv64-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='riscv64' machine='virt'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='host-passthrough' check='none'/>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-riscv64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+      <target chassis='1' port='0x8'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
+    </controller>
+    <controller type='pci' index='2' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+      <target chassis='2' port='0x9'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <graphics type='spice'>
+      <listen type='none'/>
+    </graphics>
+    <video>
+      <model type='virtio' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/default-video-type-s390x.s390x-latest.xml b/tests/qemuxml2xmloutdata/default-video-type-s390x.s390x-latest.xml
new file mode 100644
index 0000000000..21718db1ca
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/default-video-type-s390x.s390x-latest.xml
@@ -0,0 +1,32 @@
+<domain type='kvm'>
+  <name>default-video-type-s390x-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='virt'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='host-passthrough' check='none'/>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <graphics type='spice'>
+      <listen type='none'/>
+    </graphics>
+    <video>
+      <model type='virtio' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'>
+        <zpci uid='0x0001' fid='0x00000000'/>
+      </address>
+    </video>
+    <memballoon model='none'/>
+    <panic model='s390'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-0.xml b/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-0.xml
new file mode 100644
index 0000000000..645019c230
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-0.xml
@@ -0,0 +1,31 @@
+<domain type='kvm'>
+  <name>default-video-type-x86_64-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='virt'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='host-passthrough' check='none'/>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='spice'>
+      <listen type='none'/>
+    </graphics>
+    <video>
+      <model type='vga' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-1.xml b/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-1.xml
new file mode 100644
index 0000000000..f763b6902e
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-1.xml
@@ -0,0 +1,31 @@
+<domain type='kvm'>
+  <name>default-video-type-x86_64-test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='virt'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='host-passthrough' check='none'/>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='spice'>
+      <listen type='none'/>
+    </graphics>
+    <video>
+      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2c61d7db8a..8b43f35f06 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -355,6 +355,13 @@ mymain(void)
     DO_TEST("graphics-vnc-egl-headless",
             QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_EGL_HEADLESS);
 
+    DO_TEST_CAPS_ARCH_LATEST("default-video-type-aarch64", "aarch64");
+    DO_TEST_CAPS_ARCH_LATEST("default-video-type-ppc64", "ppc64");
+    DO_TEST_CAPS_ARCH_LATEST("default-video-type-riscv64", "riscv64");
+    DO_TEST_CAPS_ARCH_LATEST("default-video-type-s390x", "s390x");
+    DO_TEST("default-video-type-x86_64-caps-test-0", QEMU_CAPS_DEVICE_VGA);
+    DO_TEST("default-video-type-x86_64-caps-test-1", QEMU_CAPS_DEVICE_CIRRUS_VGA);
+
     DO_TEST("graphics-sdl", QEMU_CAPS_DEVICE_VGA);
     DO_TEST("graphics-sdl-fullscreen", QEMU_CAPS_DEVICE_CIRRUS_VGA);
     DO_TEST("graphics-spice", QEMU_CAPS_DEVICE_QXL);
-- 
2.21.0




More information about the libvir-list mailing list