6d3351
From 1185567539a1d5e0f6c99f5c55e931d9c0da1efb Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <1185567539a1d5e0f6c99f5c55e931d9c0da1efb@dist-git>
6d3351
From: Andrea Bolognani <abologna@redhat.com>
6d3351
Date: Mon, 17 Jul 2017 12:09:15 +0200
6d3351
Subject: [PATCH] tests: Add tests for pSeries guests with multiple PHBs
6d3351
6d3351
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6d3351
Reviewed-by: Laine Stump <laine@laine.org>
6d3351
(cherry picked from commit bd01ab8c1f5d7c7486c9c439b4184e06a050d2ee)
6d3351
6d3351
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1431193
6d3351
6d3351
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
---
6d3351
 .../qemuxml2argv-pseries-phb-default-missing.args  | 22 +++++++++++++++
6d3351
 .../qemuxml2argv-pseries-phb-default-missing.xml   | 16 +++++++++++
6d3351
 .../qemuxml2argv-pseries-phb-simple.args           | 22 +++++++++++++++
6d3351
 .../qemuxml2argv-pseries-phb-simple.xml            | 17 +++++++++++
6d3351
 ...qemuxml2argv-pseries-phb-wrong-target-index.xml | 22 +++++++++++++++
6d3351
 tests/qemuxml2argvtest.c                           |  9 ++++++
6d3351
 .../qemuxml2xmlout-pseries-phb-default-missing.xml | 33 ++++++++++++++++++++++
6d3351
 .../qemuxml2xmlout-pseries-phb-simple.xml          | 33 ++++++++++++++++++++++
6d3351
 tests/qemuxml2xmltest.c                            |  7 +++++
6d3351
 9 files changed, 181 insertions(+)
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-default-missing.args
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-default-missing.xml
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.args
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.xml
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml
6d3351
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml
6d3351
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-simple.xml
6d3351
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-default-missing.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-default-missing.args
6d3351
new file mode 100644
6d3351
index 0000000000..009f5a8eab
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-default-missing.args
6d3351
@@ -0,0 +1,22 @@
6d3351
+LC_ALL=C \
6d3351
+PATH=/bin \
6d3351
+HOME=/home/test \
6d3351
+USER=test \
6d3351
+LOGNAME=test \
6d3351
+QEMU_AUDIO_DRV=none \
6d3351
+/usr/bin/qemu-system-ppc64 \
6d3351
+-name QEMUGuest1 \
6d3351
+-S \
6d3351
+-M pseries \
6d3351
+-m 512 \
6d3351
+-smp 1,sockets=1,cores=1,threads=1 \
6d3351
+-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
6d3351
+-nographic \
6d3351
+-nodefconfig \
6d3351
+-nodefaults \
6d3351
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
6d3351
+server,nowait \
6d3351
+-mon chardev=charmonitor,id=monitor,mode=readline \
6d3351
+-boot c \
6d3351
+-device spapr-pci-host-bridge,index=1,id=pci.1 \
6d3351
+-device spapr-pci-host-bridge,index=2,id=pci.2
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-default-missing.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-default-missing.xml
6d3351
new file mode 100644
6d3351
index 0000000000..d0b45bfe00
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-default-missing.xml
6d3351
@@ -0,0 +1,16 @@
6d3351
+<domain type='qemu'>
6d3351
+  <name>QEMUGuest1</name>
6d3351
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
6d3351
+  <memory unit='KiB'>524288</memory>
6d3351
+  <vcpu placement='static'>1</vcpu>
6d3351
+  <os>
6d3351
+    <type arch='ppc64' machine='pseries'>hvm</type>
6d3351
+  </os>
6d3351
+  <devices>
6d3351
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
6d3351
+    <controller type='pci' index='1' model='pci-root'/>
6d3351
+    <controller type='pci' index='2' model='pci-root'/>
6d3351
+    <controller type='usb' model='none'/>
6d3351
+    <memballoon model='none'/>
6d3351
+  </devices>
6d3351
+</domain>
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.args
6d3351
new file mode 100644
6d3351
index 0000000000..009f5a8eab
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.args
6d3351
@@ -0,0 +1,22 @@
6d3351
+LC_ALL=C \
6d3351
+PATH=/bin \
6d3351
+HOME=/home/test \
6d3351
+USER=test \
6d3351
+LOGNAME=test \
6d3351
+QEMU_AUDIO_DRV=none \
6d3351
+/usr/bin/qemu-system-ppc64 \
6d3351
+-name QEMUGuest1 \
6d3351
+-S \
6d3351
+-M pseries \
6d3351
+-m 512 \
6d3351
+-smp 1,sockets=1,cores=1,threads=1 \
6d3351
+-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
6d3351
+-nographic \
6d3351
+-nodefconfig \
6d3351
+-nodefaults \
6d3351
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
6d3351
+server,nowait \
6d3351
+-mon chardev=charmonitor,id=monitor,mode=readline \
6d3351
+-boot c \
6d3351
+-device spapr-pci-host-bridge,index=1,id=pci.1 \
6d3351
+-device spapr-pci-host-bridge,index=2,id=pci.2
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.xml
6d3351
new file mode 100644
6d3351
index 0000000000..b1c6ff3006
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.xml
6d3351
@@ -0,0 +1,17 @@
6d3351
+<domain type='qemu'>
6d3351
+  <name>QEMUGuest1</name>
6d3351
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
6d3351
+  <memory unit='KiB'>524288</memory>
6d3351
+  <vcpu placement='static'>1</vcpu>
6d3351
+  <os>
6d3351
+    <type arch='ppc64' machine='pseries'>hvm</type>
6d3351
+  </os>
6d3351
+  <devices>
6d3351
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
6d3351
+    <controller type='pci' model='pci-root'/>
6d3351
+    <controller type='pci' model='pci-root'/>
6d3351
+    <controller type='pci' model='pci-root'/>
6d3351
+    <controller type='usb' model='none'/>
6d3351
+    <memballoon model='none'/>
6d3351
+  </devices>
6d3351
+</domain>
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml
6d3351
new file mode 100644
6d3351
index 0000000000..48e3b1f80b
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml
6d3351
@@ -0,0 +1,22 @@
6d3351
+<domain type='qemu'>
6d3351
+  <name>QEMUGuest1</name>
6d3351
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
6d3351
+  <memory unit='KiB'>524288</memory>
6d3351
+  <vcpu placement='static'>1</vcpu>
6d3351
+  <os>
6d3351
+    <type arch='ppc64' machine='pseries'>hvm</type>
6d3351
+  </os>
6d3351
+  <devices>
6d3351
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
6d3351
+    
6d3351
+    <controller type='pci' index='0' model='pci-root'>
6d3351
+      <target index='1'/>
6d3351
+    </controller>
6d3351
+    
6d3351
+    <controller type='pci' index='1' model='pci-root'>
6d3351
+      <target index='0'/>
6d3351
+    </controller>
6d3351
+    <controller type='usb' model='none'/>
6d3351
+    <memballoon model='none'/>
6d3351
+  </devices>
6d3351
+</domain>
6d3351
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
6d3351
index 2a0b0ce954..61a3499cd7 100644
6d3351
--- a/tests/qemuxml2argvtest.c
6d3351
+++ b/tests/qemuxml2argvtest.c
6d3351
@@ -1753,6 +1753,15 @@ mymain(void)
6d3351
             QEMU_CAPS_NODEFCONFIG);
6d3351
     DO_TEST_FAILURE("pseries-panic-address",
6d3351
                     QEMU_CAPS_NODEFCONFIG);
6d3351
+
6d3351
+    DO_TEST("pseries-phb-simple",
6d3351
+            QEMU_CAPS_NODEFCONFIG,
6d3351
+            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
6d3351
+    DO_TEST("pseries-phb-default-missing",
6d3351
+            QEMU_CAPS_NODEFCONFIG,
6d3351
+            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
6d3351
+    DO_TEST_PARSE_ERROR("pseries-phb-wrong-target-index", NONE);
6d3351
+
6d3351
     DO_TEST("disk-ide-drive-split",
6d3351
             QEMU_CAPS_NODEFCONFIG,
6d3351
             QEMU_CAPS_IDE_CD);
6d3351
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml
6d3351
new file mode 100644
6d3351
index 0000000000..62708b4a46
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml
6d3351
@@ -0,0 +1,33 @@
6d3351
+<domain type='qemu'>
6d3351
+  <name>QEMUGuest1</name>
6d3351
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
6d3351
+  <memory unit='KiB'>524288</memory>
6d3351
+  <currentMemory unit='KiB'>524288</currentMemory>
6d3351
+  <vcpu placement='static'>1</vcpu>
6d3351
+  <os>
6d3351
+    <type arch='ppc64' machine='pseries'>hvm</type>
6d3351
+    <boot dev='hd'/>
6d3351
+  </os>
6d3351
+  <clock offset='utc'/>
6d3351
+  <on_poweroff>destroy</on_poweroff>
6d3351
+  <on_reboot>restart</on_reboot>
6d3351
+  <on_crash>destroy</on_crash>
6d3351
+  <devices>
6d3351
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
6d3351
+    <controller type='pci' index='1' model='pci-root'>
6d3351
+      <model name='spapr-pci-host-bridge'/>
6d3351
+      <target index='1'/>
6d3351
+    </controller>
6d3351
+    <controller type='pci' index='2' model='pci-root'>
6d3351
+      <model name='spapr-pci-host-bridge'/>
6d3351
+      <target index='2'/>
6d3351
+    </controller>
6d3351
+    <controller type='usb' index='0' model='none'/>
6d3351
+    <controller type='pci' index='0' model='pci-root'>
6d3351
+      <model name='spapr-pci-host-bridge'/>
6d3351
+      <target index='0'/>
6d3351
+    </controller>
6d3351
+    <memballoon model='none'/>
6d3351
+    <panic model='pseries'/>
6d3351
+  </devices>
6d3351
+</domain>
6d3351
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-simple.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-simple.xml
6d3351
new file mode 100644
6d3351
index 0000000000..2c1e64e88d
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-simple.xml
6d3351
@@ -0,0 +1,33 @@
6d3351
+<domain type='qemu'>
6d3351
+  <name>QEMUGuest1</name>
6d3351
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
6d3351
+  <memory unit='KiB'>524288</memory>
6d3351
+  <currentMemory unit='KiB'>524288</currentMemory>
6d3351
+  <vcpu placement='static'>1</vcpu>
6d3351
+  <os>
6d3351
+    <type arch='ppc64' machine='pseries'>hvm</type>
6d3351
+    <boot dev='hd'/>
6d3351
+  </os>
6d3351
+  <clock offset='utc'/>
6d3351
+  <on_poweroff>destroy</on_poweroff>
6d3351
+  <on_reboot>restart</on_reboot>
6d3351
+  <on_crash>destroy</on_crash>
6d3351
+  <devices>
6d3351
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
6d3351
+    <controller type='pci' index='0' model='pci-root'>
6d3351
+      <model name='spapr-pci-host-bridge'/>
6d3351
+      <target index='0'/>
6d3351
+    </controller>
6d3351
+    <controller type='pci' index='1' model='pci-root'>
6d3351
+      <model name='spapr-pci-host-bridge'/>
6d3351
+      <target index='1'/>
6d3351
+    </controller>
6d3351
+    <controller type='pci' index='2' model='pci-root'>
6d3351
+      <model name='spapr-pci-host-bridge'/>
6d3351
+      <target index='2'/>
6d3351
+    </controller>
6d3351
+    <controller type='usb' index='0' model='none'/>
6d3351
+    <memballoon model='none'/>
6d3351
+    <panic model='pseries'/>
6d3351
+  </devices>
6d3351
+</domain>
6d3351
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
6d3351
index 95f053faa7..ba3444a051 100644
6d3351
--- a/tests/qemuxml2xmltest.c
6d3351
+++ b/tests/qemuxml2xmltest.c
6d3351
@@ -666,6 +666,13 @@ mymain(void)
6d3351
     DO_TEST("pseries-panic-missing", NONE);
6d3351
     DO_TEST("pseries-panic-no-address", NONE);
6d3351
 
6d3351
+    DO_TEST("pseries-phb-simple",
6d3351
+            QEMU_CAPS_NODEFCONFIG,
6d3351
+            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
6d3351
+    DO_TEST("pseries-phb-default-missing",
6d3351
+            QEMU_CAPS_NODEFCONFIG,
6d3351
+            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
6d3351
+
6d3351
     DO_TEST("balloon-device-auto", NONE);
6d3351
     DO_TEST("balloon-device-period", NONE);
6d3351
     DO_TEST("channel-virtio-auto", NONE);
6d3351
-- 
6d3351
2.13.3
6d3351