]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuxmlconfttest: Add test case for invalid disk target
authorPeter Krempa <pkrempa@redhat.com>
Mon, 9 Sep 2024 14:46:10 +0000 (16:46 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 10 Sep 2024 12:26:52 +0000 (14:26 +0200)
Add a test case that the numeric overflow when parsing disk target is
detected.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
tests/qemuxmlconfdata/disk-target-overflow.x86_64-latest.err [new file with mode: 0644]
tests/qemuxmlconfdata/disk-target-overflow.xml [new file with mode: 0644]
tests/qemuxmlconftest.c

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 (file)
index 0000000..cae259f
--- /dev/null
@@ -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 (file)
index 0000000..8c8a2ab
--- /dev/null
@@ -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>
index 5497fb2ba1932a2f8d8638ad964e5958889eacca..323fd9d7213cfb7ec0e2699befdcba1719383db5 100644 (file)
@@ -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");