Add a test case that the numeric overflow when parsing disk target is
detected.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
.../disk-target-overflow.x86_64-latest.err | 1 +
.../qemuxmlconfdata/disk-target-overflow.xml | 29 +++++++++++++++++++
tests/qemuxmlconftest.c | 1 +
3 files changed, 31 insertions(+)
create mode 100644 tests/qemuxmlconfdata/disk-target-overflow.x86_64-latest.err
create mode 100644 tests/qemuxmlconfdata/disk-target-overflow.xml
diff --git a/tests/qemuxmlconfdata/disk-target-overflow.x86_64-latest.err
b/tests/qemuxmlconfdata/disk-target-overflow.x86_64-latest.err
new file mode 100644
index 0000000000..cae259fad7
--- /dev/null
+++ b/tests/qemuxmlconfdata/disk-target-overflow.x86_64-latest.err
@@ -0,0 +1 @@
+XML error: Unknown disk name 'hdaxxxxxxxxxx' and no address specified
diff --git a/tests/qemuxmlconfdata/disk-target-overflow.xml
b/tests/qemuxmlconfdata/disk-target-overflow.xml
new file mode 100644
index 0000000000..8c8a2ab843
--- /dev/null
+++ b/tests/qemuxmlconfdata/disk-target-overflow.xml
@@ -0,0 +1,29 @@
+<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='x86_64' 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-x86_64</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hdaxxxxxxxxxx' bus='virtio'/>
+ </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='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 5497fb2ba1..323fd9d721 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -1622,6 +1622,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("controller-virtio-scsi");
DO_TEST_CAPS_LATEST("controller-scsi-auto");
DO_TEST_CAPS_LATEST("disk-sata-device");
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("disk-target-overflow");
DO_TEST_CAPS_LATEST("disk-aio");
DO_TEST_CAPS_LATEST("disk-aio-io_uring");
DO_TEST_CAPS_LATEST("disk-source-pool");
--
2.46.0