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