6d3351
From 27e502c108e01538227601b20a1d3d22a2b54708 Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <27e502c108e01538227601b20a1d3d22a2b54708@dist-git>
6d3351
From: Cole Robinson <crobinso@redhat.com>
6d3351
Date: Tue, 11 Jul 2017 10:57:40 +0200
6d3351
Subject: [PATCH] tests: qemuxml2argv: Add an aarch64 pci-serial test
6d3351
6d3351
This demonstrates that the previous qemu caps changes will use
6d3351
-chardev for pci-serial on aarch64 machvirt
6d3351
6d3351
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6d3351
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6d3351
(cherry picked from commit 5afe52a871825ca173a4a4a70861b56b5b00b5ad)
6d3351
6d3351
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1435681
6d3351
6d3351
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
---
6d3351
 .../qemuxml2argv-aarch64-pci-serial.args           | 26 ++++++++++++++
6d3351
 .../qemuxml2argv-aarch64-pci-serial.xml            | 16 +++++++++
6d3351
 tests/qemuxml2argvtest.c                           |  9 +++++
6d3351
 .../qemuxml2xmlout-aarch64-pci-serial.xml          | 41 ++++++++++++++++++++++
6d3351
 tests/qemuxml2xmltest.c                            |  9 +++++
6d3351
 5 files changed, 101 insertions(+)
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.args
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.xml
6d3351
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml
6d3351
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.args
6d3351
new file mode 100644
6d3351
index 0000000000..6cab29fec3
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.args
6d3351
@@ -0,0 +1,26 @@
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-aarch64 \
6d3351
+-name aarch64test \
6d3351
+-S \
6d3351
+-M virt \
6d3351
+-m 1024 \
6d3351
+-smp 1,sockets=1,cores=1,threads=1 \
6d3351
+-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
6d3351
+-nographic \
6d3351
+-nodefconfig \
6d3351
+-nodefaults \
6d3351
+-chardev socket,id=charmonitor,\
6d3351
+path=/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
6d3351
+-mon chardev=charmonitor,id=monitor,mode=readline \
6d3351
+-no-acpi \
6d3351
+-boot c \
6d3351
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \
6d3351
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
6d3351
+-device pcie-root-port,port=0x10,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \
6d3351
+-chardev pty,id=charserial0,logfile=/tmp/log,logappend=on \
6d3351
+-device pci-serial,chardev=charserial0,id=serial0,bus=pci.2,addr=0x1
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.xml
6d3351
new file mode 100644
6d3351
index 0000000000..0df12102c9
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.xml
6d3351
@@ -0,0 +1,16 @@
6d3351
+<domain type="qemu">
6d3351
+  <name>aarch64test</name>
6d3351
+  <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
6d3351
+  <memory>1048576</memory>
6d3351
+  <vcpu placement='static'>1</vcpu>
6d3351
+  <os>
6d3351
+    <type arch="aarch64" machine="virt">hvm</type>
6d3351
+  </os>
6d3351
+  <devices>
6d3351
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
6d3351
+    <serial type='pty'>
6d3351
+      <target type='pci-serial' port='0'/>
6d3351
+      <log file='/tmp/log' append='on'/>
6d3351
+    </serial>
6d3351
+  </devices>
6d3351
+</domain>
6d3351
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
6d3351
index 6ac24c9bb0..f47d282e31 100644
6d3351
--- a/tests/qemuxml2argvtest.c
6d3351
+++ b/tests/qemuxml2argvtest.c
6d3351
@@ -2347,6 +2347,15 @@ mymain(void)
6d3351
     DO_TEST_FAILURE("aarch64-kvm-32-on-64",
6d3351
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
6d3351
             QEMU_CAPS_KVM);
6d3351
+    DO_TEST("aarch64-pci-serial",
6d3351
+            QEMU_CAPS_NODEFCONFIG,
6d3351
+            QEMU_CAPS_CHARDEV,
6d3351
+            QEMU_CAPS_DEVICE_PCI_SERIAL,
6d3351
+            QEMU_CAPS_CHARDEV_LOGFILE,
6d3351
+            QEMU_CAPS_OBJECT_GPEX,
6d3351
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
6d3351
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
6d3351
+            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT);
6d3351
 
6d3351
     /* Make sure all combinations of ACPI and UEFI behave as expected */
6d3351
     DO_TEST("aarch64-acpi-uefi", NONE);
6d3351
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml
6d3351
new file mode 100644
6d3351
index 0000000000..fddab31f07
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-pci-serial.xml
6d3351
@@ -0,0 +1,41 @@
6d3351
+<domain type='qemu'>
6d3351
+  <name>aarch64test</name>
6d3351
+  <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
6d3351
+  <memory unit='KiB'>1048576</memory>
6d3351
+  <currentMemory unit='KiB'>1048576</currentMemory>
6d3351
+  <vcpu placement='static'>1</vcpu>
6d3351
+  <os>
6d3351
+    <type arch='aarch64' machine='virt'>hvm</type>
6d3351
+    <boot dev='hd'/>
6d3351
+  </os>
6d3351
+  <features>
6d3351
+    <gic version='2'/>
6d3351
+  </features>
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-aarch64</emulator>
6d3351
+    <controller type='pci' index='0' model='pcie-root'/>
6d3351
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
6d3351
+      <model name='i82801b11-bridge'/>
6d3351
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
6d3351
+    </controller>
6d3351
+    <controller type='pci' index='2' model='pci-bridge'>
6d3351
+      <model name='pci-bridge'/>
6d3351
+      <target chassisNr='2'/>
6d3351
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
6d3351
+    </controller>
6d3351
+    <controller type='pci' index='3' model='pcie-root-port'>
6d3351
+      <model name='pcie-root-port'/>
6d3351
+      <target chassis='3' port='0x10'/>
6d3351
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
6d3351
+    </controller>
6d3351
+    <serial type='pty'>
6d3351
+      <log file='/tmp/log' append='on'/>
6d3351
+      <target type='pci-serial' port='0'/>
6d3351
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
6d3351
+    </serial>
6d3351
+  </devices>
6d3351
+</domain>
6d3351
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
6d3351
index f2abad00cf..95bb154400 100644
6d3351
--- a/tests/qemuxml2xmltest.c
6d3351
+++ b/tests/qemuxml2xmltest.c
6d3351
@@ -1073,6 +1073,15 @@ mymain(void)
6d3351
             QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420,
6d3351
             QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
6d3351
             QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_BOOTINDEX);
6d3351
+    DO_TEST("aarch64-pci-serial",
6d3351
+            QEMU_CAPS_NODEFCONFIG,
6d3351
+            QEMU_CAPS_CHARDEV,
6d3351
+            QEMU_CAPS_DEVICE_PCI_SERIAL,
6d3351
+            QEMU_CAPS_CHARDEV_LOGFILE,
6d3351
+            QEMU_CAPS_OBJECT_GPEX,
6d3351
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
6d3351
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
6d3351
+            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT);
6d3351
 
6d3351
     DO_TEST_FULL("aarch64-gic-none", WHEN_BOTH, GIC_NONE, NONE);
6d3351
     DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH, GIC_V2, NONE);
6d3351
-- 
6d3351
2.13.3
6d3351