Add a single testcase for the case where format probing is allowed.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
.../qemuxml2argvdata/disk-many-format-probing.args | 29 ++++++++++++
.../qemuxml2argvdata/disk-many-format-probing.xml | 48 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 6 +++
.../disk-many-format-probing.xml | 52 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 6 +++
5 files changed, 141 insertions(+)
create mode 100644 tests/qemuxml2argvdata/disk-many-format-probing.args
create mode 100644 tests/qemuxml2argvdata/disk-many-format-probing.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-many-format-probing.xml
diff --git a/tests/qemuxml2argvdata/disk-many-format-probing.args
b/tests/qemuxml2argvdata/disk-many-format-probing.args
new file mode 100644
index 0000000000..cbb765a250
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-many-format-probing.args
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-ide0-0-1 \
+-device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
+-drive file=/tmp/data.img,if=none,id=drive-ide0-1-0 \
+-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
+-drive file=/tmp/logs.img,if=none,id=drive-ide0-1-1 \
+-device ide-drive,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1
diff --git a/tests/qemuxml2argvdata/disk-many-format-probing.xml
b/tests/qemuxml2argvdata/disk-many-format-probing.xml
new file mode 100644
index 0000000000..5e34eb46e0
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-many-format-probing.xml
@@ -0,0 +1,48 @@
+<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'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu'/>
+ <source dev='/dev/HostVG/QEMUGuest2'/>
+ <target dev='hdb' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='1'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu'/>
+ <source file='/tmp/data.img'/>
+ <target dev='hdc' bus='ide'/>
+ <address type='drive' controller='0' bus='1'
target='0' unit='0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu'/>
+ <source file='/tmp/logs.img'/>
+ <target dev='hdd' bus='ide'/>
+ <address type='drive' controller='0' bus='1'
target='0' unit='1'/>
+ </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'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 688846b9b4..7d6b6fe44a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2966,6 +2966,12 @@ mymain(void)
QEMU_CAPS_HDA_DUPLEX);
DO_TEST("user-aliases2", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI);
+ /* Test disks with format probing enabled for legacy reasons.
+ * New tests should not go in this section. */
+ driver.config->allowDiskFormatProbing = true;
+ DO_TEST("disk-many-format-probing", QEMU_CAPS_DRIVE_BOOT);
+ driver.config->allowDiskFormatProbing = false;
+
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);
diff --git a/tests/qemuxml2xmloutdata/disk-many-format-probing.xml
b/tests/qemuxml2xmloutdata/disk-many-format-probing.xml
new file mode 100644
index 0000000000..914b9b0937
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-many-format-probing.xml
@@ -0,0 +1,52 @@
+<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'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu'/>
+ <source dev='/dev/HostVG/QEMUGuest2'/>
+ <target dev='hdb' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='1'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu'/>
+ <source file='/tmp/data.img'/>
+ <target dev='hdc' bus='ide'/>
+ <address type='drive' controller='0' bus='1'
target='0' unit='0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu'/>
+ <source file='/tmp/logs.img'/>
+ <target dev='hdd' bus='ide'/>
+ <address type='drive' controller='0' bus='1'
target='0' unit='1'/>
+ </disk>
+ <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'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2cbe0c82a7..0b9efaad50 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1344,6 +1344,12 @@ mymain(void)
DO_TEST("user-aliases", NONE);
+ /* Test disks with format probing enabled for legacy reasons.
+ * New tests should not go in this section. */
+ driver.config->allowDiskFormatProbing = true;
+ DO_TEST("disk-many-format-probing", NONE);
+ driver.config->allowDiskFormatProbing = false;
+
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);
--
2.16.2