c1c534
From 4b4ddd95952a455426ec82c45c8309e346bb29c7 Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <4b4ddd95952a455426ec82c45c8309e346bb29c7@dist-git>
c1c534
From: Andrea Bolognani <abologna@redhat.com>
c1c534
Date: Wed, 15 Nov 2017 10:28:55 +0100
c1c534
Subject: [PATCH] tests: Add tests for configuration of HPT resizing
c1c534
c1c534
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
c1c534
Reviewed-by: John Ferlan <jferlan@redhat.com>
c1c534
(cherry picked from commit 5e192a36201ed165c79bf66336747c220a7d63a2)
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1308743
c1c534
c1c534
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 ...l2argv-pseries-hpt-resizing-invalid-machine.xml | 18 ++++++++++++++
c1c534
 .../qemuxml2argv-pseries-hpt-resizing.args         | 20 ++++++++++++++++
c1c534
 .../qemuxml2argv-pseries-hpt-resizing.xml          | 19 +++++++++++++++
c1c534
 tests/qemuxml2argvtest.c                           | 12 ++++++++++
c1c534
 .../qemuxml2xmlout-pseries-hpt-resizing.xml        | 28 ++++++++++++++++++++++
c1c534
 tests/qemuxml2xmltest.c                            |  5 ++++
c1c534
 6 files changed, 102 insertions(+)
c1c534
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-invalid-machine.xml
c1c534
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing.args
c1c534
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing.xml
c1c534
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing.xml
c1c534
c1c534
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-invalid-machine.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-invalid-machine.xml
c1c534
new file mode 100644
c1c534
index 0000000000..757fcc70e1
c1c534
--- /dev/null
c1c534
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-invalid-machine.xml
c1c534
@@ -0,0 +1,18 @@
c1c534
+<domain type='qemu'>
c1c534
+  <name>guest</name>
c1c534
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
c1c534
+  <memory unit='KiB'>524288</memory>
c1c534
+  <vcpu placement='static'>1</vcpu>
c1c534
+  <os>
c1c534
+    <type arch='x86_64' machine='pc'>hvm</type>
c1c534
+  </os>
c1c534
+  <features>
c1c534
+    
c1c534
+    <hpt resizing='enabled'/>
c1c534
+  </features>
c1c534
+  <devices>
c1c534
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
c1c534
+    <controller type='usb' model='none'/>
c1c534
+    <memballoon model='none'/>
c1c534
+  </devices>
c1c534
+</domain>
c1c534
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing.args
c1c534
new file mode 100644
c1c534
index 0000000000..994789a5e0
c1c534
--- /dev/null
c1c534
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing.args
c1c534
@@ -0,0 +1,20 @@
c1c534
+LC_ALL=C \
c1c534
+PATH=/bin \
c1c534
+HOME=/home/test \
c1c534
+USER=test \
c1c534
+LOGNAME=test \
c1c534
+QEMU_AUDIO_DRV=none \
c1c534
+/usr/bin/qemu-system-ppc64 \
c1c534
+-name guest \
c1c534
+-S \
c1c534
+-machine pseries,accel=tcg,resize-hpt=required \
c1c534
+-m 512 \
c1c534
+-smp 1,sockets=1,cores=1,threads=1 \
c1c534
+-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
c1c534
+-nographic \
c1c534
+-nodefconfig \
c1c534
+-nodefaults \
c1c534
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\
c1c534
+server,nowait \
c1c534
+-mon chardev=charmonitor,id=monitor,mode=readline \
c1c534
+-boot c
c1c534
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing.xml
c1c534
new file mode 100644
c1c534
index 0000000000..f9dc9cac94
c1c534
--- /dev/null
c1c534
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing.xml
c1c534
@@ -0,0 +1,19 @@
c1c534
+<domain type='qemu'>
c1c534
+  <name>guest</name>
c1c534
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
c1c534
+  <memory unit='KiB'>524288</memory>
c1c534
+  <vcpu placement='static'>1</vcpu>
c1c534
+  <os>
c1c534
+    <type arch='ppc64' machine='pseries'>hvm</type>
c1c534
+  </os>
c1c534
+  <features>
c1c534
+    
c1c534
+         at all unless HPT resizing can be arranged -->
c1c534
+    <hpt resizing='required'/>
c1c534
+  </features>
c1c534
+  <devices>
c1c534
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
c1c534
+    <controller type='usb' model='none'/>
c1c534
+    <memballoon model='none'/>
c1c534
+  </devices>
c1c534
+</domain>
c1c534
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
c1c534
index 03b1bcbcf7..ecc86d045c 100644
c1c534
--- a/tests/qemuxml2argvtest.c
c1c534
+++ b/tests/qemuxml2argvtest.c
c1c534
@@ -1848,6 +1848,18 @@ mymain(void)
c1c534
             QEMU_CAPS_VIRTIO_SCSI,
c1c534
             QEMU_CAPS_DEVICE_VFIO_PCI);
c1c534
 
c1c534
+    DO_TEST("pseries-hpt-resizing",
c1c534
+            QEMU_CAPS_NODEFCONFIG,
c1c534
+            QEMU_CAPS_MACHINE_OPT,
c1c534
+            QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
c1c534
+    DO_TEST_FAILURE("pseries-hpt-resizing",
c1c534
+                    QEMU_CAPS_NODEFCONFIG,
c1c534
+                    QEMU_CAPS_MACHINE_OPT);
c1c534
+    DO_TEST_PARSE_ERROR("pseries-hpt-resizing-invalid-machine",
c1c534
+                        QEMU_CAPS_NODEFCONFIG,
c1c534
+                        QEMU_CAPS_MACHINE_OPT,
c1c534
+                        QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
c1c534
+
c1c534
     DO_TEST("disk-ide-drive-split",
c1c534
             QEMU_CAPS_NODEFCONFIG,
c1c534
             QEMU_CAPS_IDE_CD);
c1c534
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing.xml
c1c534
new file mode 100644
c1c534
index 0000000000..5dd0dbd0be
c1c534
--- /dev/null
c1c534
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing.xml
c1c534
@@ -0,0 +1,28 @@
c1c534
+<domain type='qemu'>
c1c534
+  <name>guest</name>
c1c534
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
c1c534
+  <memory unit='KiB'>524288</memory>
c1c534
+  <currentMemory unit='KiB'>524288</currentMemory>
c1c534
+  <vcpu placement='static'>1</vcpu>
c1c534
+  <os>
c1c534
+    <type arch='ppc64' machine='pseries'>hvm</type>
c1c534
+    <boot dev='hd'/>
c1c534
+  </os>
c1c534
+  <features>
c1c534
+    <hpt resizing='required'/>
c1c534
+  </features>
c1c534
+  <clock offset='utc'/>
c1c534
+  <on_poweroff>destroy</on_poweroff>
c1c534
+  <on_reboot>restart</on_reboot>
c1c534
+  <on_crash>destroy</on_crash>
c1c534
+  <devices>
c1c534
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
c1c534
+    <controller type='usb' index='0' model='none'/>
c1c534
+    <controller type='pci' index='0' model='pci-root'>
c1c534
+      <model name='spapr-pci-host-bridge'/>
c1c534
+      <target index='0'/>
c1c534
+    </controller>
c1c534
+    <memballoon model='none'/>
c1c534
+    <panic model='pseries'/>
c1c534
+  </devices>
c1c534
+</domain>
c1c534
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
c1c534
index fdba2adb98..6687997900 100644
c1c534
--- a/tests/qemuxml2xmltest.c
c1c534
+++ b/tests/qemuxml2xmltest.c
c1c534
@@ -761,6 +761,11 @@ mymain(void)
c1c534
             QEMU_CAPS_VIRTIO_SCSI,
c1c534
             QEMU_CAPS_DEVICE_VFIO_PCI);
c1c534
 
c1c534
+    DO_TEST("pseries-hpt-resizing",
c1c534
+            QEMU_CAPS_NODEFCONFIG,
c1c534
+            QEMU_CAPS_MACHINE_OPT,
c1c534
+            QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
c1c534
+
c1c534
     DO_TEST("balloon-device-auto", NONE);
c1c534
     DO_TEST("balloon-device-period", NONE);
c1c534
     DO_TEST("channel-virtio-auto", NONE);
c1c534
-- 
c1c534
2.15.0
c1c534