diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.args
similarity index 89%
rename from tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args
rename to tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.args
index 7e1fb6b371..cfa63b13ae 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.args
@@ -18,5 +18,5 @@ QEMU_AUDIO_DRV=none \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--vnc unix:/tmp/lib/domain--1-QEMUGuest1/vnc.socket \
+-vnc unix:/tmp/lib/domain--1-QEMUGuest1/vnc.sock \
-vga cirrus
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.xml
new file mode 100644
index 0000000000..af961a5309
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.xml
@@ -0,0 +1,34 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219100
+ 219100
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-remove-generated-socket.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-remove-generated-socket.args
new file mode 100644
index 0000000000..ea2e4d0a67
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-remove-generated-socket.args
@@ -0,0 +1,22 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-vnc 127.0.0.1:0 \
+-vga cirrus
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-remove-generated-socket.xml
similarity index 100%
rename from tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml
rename to tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-remove-generated-socket.xml
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 094f1ea626..540b3de813 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -898,6 +898,10 @@ mymain(void)
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);
DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC);
+ DO_TEST("graphics-vnc-remove-generated-socket", QEMU_CAPS_VNC);
+ driver.config->vncAutoUnixSocket = true;
+ DO_TEST("graphics-vnc-auto-socket-cfg", QEMU_CAPS_VNC);
+ driver.config->vncAutoUnixSocket = false;
driver.config->vncSASL = 1;
VIR_FREE(driver.config->vncSASLdir);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml
similarity index 100%
rename from tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
rename to tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-remove-generated-socket-active.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-remove-generated-socket-active.xml
new file mode 100644
index 0000000000..f3ccfdf458
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-remove-generated-socket-active.xml
@@ -0,0 +1,39 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219100
+ 219100
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-remove-generated-socket-inactive.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-remove-generated-socket-inactive.xml
new file mode 100644
index 0000000000..571804175c
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-remove-generated-socket-inactive.xml
@@ -0,0 +1,41 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219100
+ 219100
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index ab03d1fb2c..b8fac59147 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -265,6 +265,8 @@ mymain(void)
if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
+ cfg = virQEMUDriverGetConfig(&driver);
+
/* TODO: test with format probing disabled too */
driver.config->allowDiskFormatProbing = true;
@@ -430,6 +432,11 @@ mymain(void)
DO_TEST("graphics-vnc-sasl");
DO_TEST("graphics-vnc-tls");
DO_TEST("graphics-vnc-no-listen-attr");
+ DO_TEST("graphics-vnc-remove-generated-socket");
+ cfg->vncAutoUnixSocket = true;
+ DO_TEST("graphics-vnc-auto-socket-cfg");
+ cfg->vncAutoUnixSocket = false;
+
DO_TEST("graphics-sdl");
DO_TEST("graphics-sdl-fullscreen");
DO_TEST("graphics-spice");
@@ -799,11 +806,6 @@ mymain(void)
DO_TEST("virtio-input");
DO_TEST("virtio-input-passthrough");
- cfg = virQEMUDriverGetConfig(&driver);
- cfg->vncAutoUnixSocket = true;
- DO_TEST_FULL("graphics-vnc-autosocket", WHEN_INACTIVE, GIC_NONE, NONE);
- cfg->vncAutoUnixSocket = false;
-
virObjectUnref(cfg);
qemuTestDriverFree(&driver);