[03/12] tests: qemuxml2argv: Add an aarch64 pci-serial test

Message ID 7f54b32ba02a389cd28f3d859ae352f8de1c4df9.1498499391.git.crobinso@redhat.com
State New
Headers show
Series
  • qemu: support chardev for all machvirt config
Related show

Commit Message

Cole Robinson June 26, 2017, 6:01 p.m.
This demonstrates that the previous qemu caps changes will use
-chardev for pci-serial on aarch64 machvirt

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 .../qemuxml2argv-aarch64-pci-serial.args           | 26 ++++++++++++++++++++++
 .../qemuxml2argv-aarch64-pci-serial.xml            | 17 ++++++++++++++
 tests/qemuxml2argvtest.c                           |  7 ++++++
 3 files changed, 50 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.xml

-- 
2.13.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Andrea Bolognani July 7, 2017, 11:49 a.m. | #1
On Mon, 2017-06-26 at 14:01 -0400, Cole Robinson wrote:
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.xml
> @@ -0,0 +1,17 @@
> +<domain type="qemu">
> +  <name>aarch64test</name>
> +  <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
> +  <memory>1048576</memory>
> +  <currentMemory>1048576</currentMemory>

You can leave out <currentMemory> here.

> +  <vcpu placement='static'>1</vcpu>
> +  <os>
> +    <type>hvm</type>

This should be

  <type arch='aarch64' machine='virt'>hvm</type>

> +  </os>
> +  <devices>
> +    <emulator>/usr/bin/qemu-system-aarch64</emulator>
> +    <serial type='pty'>
> +      <target type='pci-serial' port='0'/>
> +      <log file='/tmp/log' append='on'/>
> +    </serial>

You can give the serial an explicit PCI address on pcie-root
to avoid the dmi-to-pci-bridge and pci-bridge later. Or not,
I leave that up to you.

> +++ b/tests/qemuxml2argvtest.c
> @@ -2342,6 +2342,13 @@ mymain(void)
>      DO_TEST_FAILURE("aarch64-kvm-32-on-64",
>              QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
>              QEMU_CAPS_KVM);
> +    DO_TEST("aarch64-pci-serial",
> +            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CHARDEV,
> +            QEMU_CAPS_DEVICE_PCI_SERIAL, QEMU_CAPS_CHARDEV_LOGFILE,
> +            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
> +            QEMU_CAPS_PCI_MULTIFUNCTION,
> +            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
> +            QEMU_CAPS_DEVICE_IOH3420);

Use QEMU_CAPS_DEVICE_PCIE_ROOT_PORT instead of _IOH3420.
_MULTIFUNCTION is not needed for this test case, since the
guest doesn't have nearly enough devices for it to make a
difference.

If you gave the pci-serial an explicit address, you can
of course get rid of _PCI_BRIDGE, _DMI_TO_PCI_BRIDGE,
_MULTIFUNCTION and _IOH3420 altogether.

Please add the test case to qemuxml2xmltest as well.


Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Patch

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.args
new file mode 100644
index 000000000..79153d2f4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.args
@@ -0,0 +1,26 @@ 
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 \
+-name aarch64test \
+-S \
+-M virt \
+-m 1024 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-chardev socket,id=charmonitor,\
+path=/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
+-device ioh3420,port=0x10,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \
+-chardev pty,id=charserial0,logfile=/tmp/log,logappend=on \
+-device pci-serial,chardev=charserial0,id=serial0,bus=pci.2,addr=0x1
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.xml
new file mode 100644
index 000000000..f3d04a2a5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-pci-serial.xml
@@ -0,0 +1,17 @@ 
+<domain type="qemu">
+  <name>aarch64test</name>
+  <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
+  <memory>1048576</memory>
+  <currentMemory>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <serial type='pty'>
+      <target type='pci-serial' port='0'/>
+      <log file='/tmp/log' append='on'/>
+    </serial>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 27eea70ae..b41c41a96 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2342,6 +2342,13 @@  mymain(void)
     DO_TEST_FAILURE("aarch64-kvm-32-on-64",
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
             QEMU_CAPS_KVM);
+    DO_TEST("aarch64-pci-serial",
+            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CHARDEV,
+            QEMU_CAPS_DEVICE_PCI_SERIAL, QEMU_CAPS_CHARDEV_LOGFILE,
+            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_PCI_MULTIFUNCTION,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_IOH3420);
 
     /* Make sure all combinations of ACPI and UEFI behave as expected */
     DO_TEST("aarch64-acpi-uefi", NONE);