Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
tests/qemuxml2argvdata/disk-cache.args | 38 +++++++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmloutdata/disk-cache.xml | 54 +++++++++++++++++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
4 files changed, 94 insertions(+)
create mode 100644 tests/qemuxml2argvdata/disk-cache.args
create mode 100644 tests/qemuxml2xmloutdata/disk-cache.xml
diff --git a/tests/qemuxml2argvdata/disk-cache.args
b/tests/qemuxml2argvdata/disk-cache.args
new file mode 100644
index 0000000000..ee2f79a99f
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-cache.args
@@ -0,0 +1,38 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc-i440fx-2.6,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot c \
+-device lsi,id=scsi0,bus=pci.0,addr=0x3 \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-0,\
+cache=writeback \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-scsi0-0-0,\
+cache=none \
+-device scsi-disk,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 \
+-drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-virtio-disk0,\
+cache=writethrough \
+-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
+id=virtio-disk0 \
+-drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-usb-disk1,\
+cache=directsync \
+-device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk1,id=usb-disk1
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 6f6b5869b3..d3c2101abd 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1037,6 +1037,7 @@ mymain(void)
DO_TEST("disk-cache-v2-none", NONE);
DO_TEST("disk-cache-directsync", NONE);
DO_TEST("disk-cache-unsafe", NONE);
+ DO_TEST("disk-cache", QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_USB_STORAGE);
DO_TEST_CAPS_VER("disk-cache", "2.6.0");
DO_TEST_CAPS_VER("disk-cache", "2.7.0");
DO_TEST_CAPS_LATEST("disk-cache");
diff --git a/tests/qemuxml2xmloutdata/disk-cache.xml
b/tests/qemuxml2xmloutdata/disk-cache.xml
new file mode 100644
index 0000000000..4c2a196ac0
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-cache.xml
@@ -0,0 +1,54 @@
+<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-i440fx-2.6'>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='qcow2' cache='writeback'/>
+ <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' type='qcow2' cache='none'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sda' bus='scsi'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'
cache='writethrough'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x0'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'
cache='directsync'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sdb' bus='usb'/>
+ </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'/>
+ <controller type='scsi' index='0' model='lsilogic'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </controller>
+ <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 904b86571f..a3480cd5d1 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -362,6 +362,7 @@ mymain(void)
DO_TEST("disk-cache-v2-none", NONE);
DO_TEST("disk-cache-directsync", NONE);
DO_TEST("disk-cache-unsafe", NONE);
+ DO_TEST("disk-cache", QEMU_CAPS_SCSI_LSI);
DO_TEST("disk-network-nbd", NONE);
DO_TEST("disk-network-nbd-export", NONE);
DO_TEST("disk-network-nbd-ipv6", NONE);
--
2.16.2