[PATCH 2/5] qemuxml2argvdata: Extend memory-hotplug-virtio-mem-overlap-address.xml

Michal Privoznik posted 5 patches 2 years, 3 months ago
[PATCH 2/5] qemuxml2argvdata: Extend memory-hotplug-virtio-mem-overlap-address.xml
Posted by Michal Privoznik 2 years, 3 months ago
This test case of qemuxml2argvtest is used to check whether we
correctly identify overlapping memory devices. Well, so far we
consider just virtio-mem and virtio-pmem devices, but this is
about to change and be extended for other models too. Extend the
test case now to de-clutter next commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 ...ory-hotplug-virtio-mem-overlap-address.xml | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.xml b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.xml
index 65999ccd99..f64931c225 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.xml
@@ -1,7 +1,7 @@
 <domain type='kvm'>
   <name>QEMUGuest1</name>
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <maxMemory unit='KiB'>1099511627776</maxMemory>
+  <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
   <memory unit='KiB'>8388608</memory>
   <currentMemory unit='KiB'>8388608</currentMemory>
   <vcpu placement='static' cpuset='0-1'>2</vcpu>
@@ -22,6 +22,23 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <memory model="dimm">
+      <target>
+        <size unit="KiB">131072</size>
+        <node>0</node>
+      </target>
+      <address type="dimm" slot="0" base="0x170000000"/>
+    </memory>
+    <memory model="nvdimm">
+      <source>
+        <path>/tmp/nvdimm</path>
+      </source>
+      <target>
+        <size unit="KiB">131072</size>
+        <node>0</node>
+      </target>
+      <address type="dimm" slot="1" base="0x140000000"/>
+    </memory>
     <memory model='virtio-mem'>
       <target>
         <size unit='KiB'>1048576</size>
-- 
2.41.0

_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH 2/5] qemuxml2argvdata: Extend memory-hotplug-virtio-mem-overlap-address.xml
Posted by Peter Krempa 2 years, 2 months ago
On Mon, Nov 06, 2023 at 12:38:25 +0100, Michal Privoznik wrote:
> This test case of qemuxml2argvtest is used to check whether we
> correctly identify overlapping memory devices. Well, so far we
> consider just virtio-mem and virtio-pmem devices, but this is
> about to change and be extended for other models too. Extend the
> test case now to de-clutter next commit.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  ...ory-hotplug-virtio-mem-overlap-address.xml | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.xml b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.xml
> index 65999ccd99..f64931c225 100644
> --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.xml
> +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.xml
> @@ -1,7 +1,7 @@
>  <domain type='kvm'>
>    <name>QEMUGuest1</name>
>    <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
> -  <maxMemory unit='KiB'>1099511627776</maxMemory>
> +  <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
>    <memory unit='KiB'>8388608</memory>
>    <currentMemory unit='KiB'>8388608</currentMemory>
>    <vcpu placement='static' cpuset='0-1'>2</vcpu>
> @@ -22,6 +22,23 @@
>    <on_crash>destroy</on_crash>
>    <devices>
>      <emulator>/usr/bin/qemu-system-x86_64</emulator>
> +    <memory model="dimm">
> +      <target>
> +        <size unit="KiB">131072</size>
> +        <node>0</node>
> +      </target>
> +      <address type="dimm" slot="0" base="0x170000000"/>
> +    </memory>
> +    <memory model="nvdimm">
> +      <source>
> +        <path>/tmp/nvdimm</path>
> +      </source>
> +      <target>
> +        <size unit="KiB">131072</size>
> +        <node>0</node>
> +      </target>
> +      <address type="dimm" slot="1" base="0x140000000"/>
> +    </memory>

To properly test negative cases you need to have multiple test cases for
each single sub-case you want to test as there's just one error we can
check against.

Preferrably add another test case for anything you want to test.

>      <memory model='virtio-mem'>
>        <target>
>          <size unit='KiB'>1048576</size>
> -- 
> 2.41.0
> 
> _______________________________________________
> Devel mailing list -- devel@lists.libvirt.org
> To unsubscribe send an email to devel-leave@lists.libvirt.org
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org