From: Zeng Junliang <zengjunliang(a)huawei.com>
While adding support for secondary-vga, we should
add test cases for it and test its basic functions.
Signed-off-by: Zeng Junliang <zengjunliang(a)huawei.com>
Signed-off-by: Wang Rui <moon.wangrui(a)huawei.com>
---
qemuxml2argv-graphics-vnc-secondary-vga.xml | 39 ++++++++++++++++++++++
.../qemuxml2argv-graphics-vnc-secondary-vga.args | 7 ++++
.../qemuxml2argv-graphics-vnc-secondary-vga.xml | 39 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 10 +++---
tests/qemuxml2xmltest.c | 1 +
5 files changed, 90 insertions(+), 6 deletions(-)
create mode 100644 qemuxml2argv-graphics-vnc-secondary-vga.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml
diff --git a/qemuxml2argv-graphics-vnc-secondary-vga.xml
b/qemuxml2argv-graphics-vnc-secondary-vga.xml
new file mode 100644
index 0000000..d43cf36
--- /dev/null
+++ b/qemuxml2argv-graphics-vnc-secondary-vga.xml
@@ -0,0 +1,39 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</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</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>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' port='5903' autoport='no'
listen='2001:1:2:3:4:5:1234:1234'>
+ <listen type='address' address='2001:1:2:3:4:5:1234:1234'/>
+ </graphics>
+ <video>
+ <model type='secondary' vgamem='16384' heads='1'/>
+ </video>
+ <video>
+ <model type='secondary' vgamem='16384' heads='1'/>
+ </video>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args
new file mode 100644
index 0000000..305c76a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor unix:/tmp/test-monitor,\
+server,nowait -no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 \
+-vnc '[2001:1:2:3:4:5:1234:1234]:3' \
+-device secondary-vga,id=video0,vgamem_mb=16,bus=pci.0,addr=0x2 \
+-device secondary-vga,id=video1,vgamem_mb=16,bus=pci.0,addr=0x4 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml
new file mode 100644
index 0000000..d43cf36
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml
@@ -0,0 +1,39 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</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</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>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' port='5903' autoport='no'
listen='2001:1:2:3:4:5:1234:1234'>
+ <listen type='address' address='2001:1:2:3:4:5:1234:1234'/>
+ </graphics>
+ <video>
+ <model type='secondary' vgamem='16384' heads='1'/>
+ </video>
+ <video>
+ <model type='secondary' vgamem='16384' heads='1'/>
+ </video>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a841adb..5e75e8f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -291,7 +291,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
goto ok;
goto out;
}
-
if (!virDomainDefCheckABIStability(vmdef, vmdef)) {
fprintf(stderr, "ABI stability check failed on %s", xml);
goto out;
@@ -327,7 +326,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
goto out;
}
}
-
log = virtTestLogContentAndReset();
VIR_FREE(log);
virResetLastError();
@@ -354,7 +352,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
if (qemuTranslateDiskSourcePool(conn, vmdef->disks[i]) < 0)
goto out;
}
-
if (!(cmd = qemuBuildCommandLine(conn, &driver, vmdef, &monitor_chr,
(flags & FLAG_JSON), extraFlags,
migrateFrom, migrateFd, NULL,
@@ -374,7 +371,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
fprintf(stderr, "qemuBuildCommandLine should have failed\n");
goto out;
}
-
if (!virtTestOOMActive() &&
(!!virGetLastError() != !!(flags & FLAG_EXPECT_ERROR))) {
if (virTestGetDebug() && (log = virtTestLogContentAndReset()))
@@ -384,13 +380,11 @@ static int testCompareXMLToArgvFiles(const char *xml,
if (!(actualargv = virCommandToString(cmd)))
goto out;
-
len = virtTestLoadFile(cmdline, &expectargv);
if (len < 0)
goto out;
if (len && expectargv[len - 1] == '\n')
expectargv[len - 1] = '\0';
-
if (STRNEQ(expectargv, actualargv)) {
virtTestDifference(stderr, expectargv, actualargv);
goto out;
@@ -858,6 +852,10 @@ mymain(void)
QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI);
DO_TEST("graphics-vnc", QEMU_CAPS_VNC);
+ DO_TEST("graphics-vnc-secondary-vga",
+ QEMU_CAPS_VNC, QEMU_CAPS_DEVICE,
+ QEMU_CAPS_DEVICE_SECONDARY_VGA,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC);
DO_TEST("graphics-vnc-websocket", QEMU_CAPS_VNC, QEMU_CAPS_VNC_WEBSOCKET);
DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, QEMU_CAPS_VNC_SHARE_POLICY);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 26e3cad..9d19e58 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -231,6 +231,7 @@ mymain(void)
DO_TEST_FULL("disk-mirror", true, WHEN_INACTIVE);
DO_TEST("graphics-listen-network");
DO_TEST("graphics-vnc");
+ DO_TEST("graphics-vnc-secondary-vga");
DO_TEST("graphics-vnc-websocket");
DO_TEST("graphics-vnc-sasl");
DO_TEST("graphics-vnc-tls");
--
1.7.12.4