[libvirt] [PATCH 4/4] tests: Add separate tests for 'xres' and 'yres'

Ján Tomko jtomko at redhat.com
Mon Aug 5 10:52:10 UTC 2019


On Sun, Aug 04, 2019 at 10:21:21PM -0300, jcfaracco at gmail.com wrote:
>From: Julio Faracco <jcfaracco at gmail.com>
>
>New tests to verify resolution properties of a simple qxl video.
>
>Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
>---
> .../video-qxl-resolution.args                 | 32 +++++++++++++++

xml->argv test should be introduced along with the qemu_command changes.

> .../qemuxml2argvdata/video-qxl-resolution.xml | 40 +++++++++++++++++++
> tests/qemuxml2argvtest.c                      |  4 ++
> .../video-qxl-resolution.xml                  | 40 +++++++++++++++++++
> tests/qemuxml2xmltest.c                       |  1 +
> 5 files changed, 117 insertions(+)
> create mode 100644 tests/qemuxml2argvdata/video-qxl-resolution.args
> create mode 100644 tests/qemuxml2argvdata/video-qxl-resolution.xml
> create mode 100644 tests/qemuxml2xmloutdata/video-qxl-resolution.xml
>
>diff --git a/tests/qemuxml2argvdata/video-qxl-resolution.args b/tests/qemuxml2argvdata/video-qxl-resolution.args
>new file mode 100644
>index 0000000000..71370ff735
>diff --git a/tests/qemuxml2argvdata/video-qxl-resolution.xml b/tests/qemuxml2argvdata/video-qxl-resolution.xml
>new file mode 100644
>index 0000000000..c6275c1bc5
>--- /dev/null
>+++ b/tests/qemuxml2argvdata/video-qxl-resolution.xml
>@@ -0,0 +1,40 @@
>+<domain type='qemu'>
>+  <name>QEMUGuest1</name>
>+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
>+  <memory unit='KiB'>219136</memory>
>+  <currentMemory unit='KiB'>219136</currentMemory>
>+  <vcpu placement='static'>1</vcpu>
>+  <os>
>+    <type arch='i686' machine='pc'>hvm</type>
>+    <boot dev='hd'/>
>+  </os>
>+  <clock offset='utc'/>
>+  <on_poweroff>destroy</on_poweroff>
>+  <on_reboot>restart</on_reboot>
>+  <on_crash>destroy</on_crash>
>+  <devices>
>+    <emulator>/usr/bin/qemu-system-i686</emulator>
>+    <disk type='block' device='disk'>
>+      <driver name='qemu' type='raw'/>
>+      <source dev='/dev/HostVG/QEMUGuest1'/>
>+      <target dev='hda' bus='ide'/>
>+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
>+    </disk>

No need for a disk for testing graphics devices.

>+    <controller type='usb' index='0'>
>+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
>+    </controller>
>+    <controller type='ide' index='0'>
>+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
>+    </controller>
>+    <controller type='pci' index='0' model='pci-root'/>
>+    <input type='mouse' bus='ps2'/>
>+    <input type='keyboard' bus='ps2'/>
>+    <video>
>+      <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1' xres='1280' yres='720' primary='yes'/>

I'm not a fan of blindly copying qemu's laconic arguments.
Also, for other devices, we'd put such arguments into the <driver>
element, not <model>.

So I propose either:
<model>
  <resolution x='1280' y='720'/>
</model>

or

<driver>
  <resolution x='1280' y='720'/>
</driver>
>+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
>+    </video>
>+    <memballoon model='virtio'>
>+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
>+    </memballoon>
>+  </devices>
>+</domain>
>diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
>index c166fd18d6..b67ba8f135 100644
>--- a/tests/qemuxml2argvtest.c
>+++ b/tests/qemuxml2argvtest.c
>@@ -2003,6 +2003,10 @@ mymain(void)
>             QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
>             QEMU_CAPS_DEVICE_QXL,
>             QEMU_CAPS_QXL_MAX_OUTPUTS);
>+    DO_TEST("video-qxl-resolution",
>+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
>+            QEMU_CAPS_DEVICE_QXL,
>+            QEMU_CAPS_QXL_MAX_OUTPUTS);

Please use DO_TEST_CAPS_LATEST which runs the test with the latest QEMU
capabilities we have collected from a real QEMU instance. With manually
enumerating the capabilities there's a risk of missing some.

If you want to test it against an older QEMU version which lacked some
capability, there's DO_TEST_CAPS_VER

Jano

>     DO_TEST("video-virtio-gpu-device",
>             QEMU_CAPS_DEVICE_VIRTIO_GPU,
>             QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190805/8a74e65d/attachment-0001.sig>


More information about the libvir-list mailing list