[libvirt] [PATCH 8/9] tests/qemuxml2argvtest: test RISC-V virt machine arguments

Lubomir Rintel lkundrak at v3.sk
Tue May 15 10:53:10 UTC 2018


I am not sure whether this test makes sense. The generated command line
is indeed sensible, but other tests seem to focus on testing particular
devices as opposed to an overall check of a machine.

Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
---
 tests/qemuxml2argvdata/riscv64-virt.args      | 29 +++++++++++++++
 tests/qemuxml2argvdata/riscv64-virt.xml       | 34 +++++++++++++++++
 tests/qemuxml2argvtest.c                      |  2 +
 .../riscv64-virt.xml                          | 37 +++++++++++++++++++
 4 files changed, 102 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/riscv64-virt.args
 create mode 100644 tests/qemuxml2argvdata/riscv64-virt.xml
 create mode 100644 tests/qemuxml2startupxmloutdata/riscv64-virt.xml

diff --git a/tests/qemuxml2argvdata/riscv64-virt.args b/tests/qemuxml2argvdata/riscv64-virt.args
new file mode 100644
index 0000000000..0404afdd27
--- /dev/null
+++ b/tests/qemuxml2argvdata/riscv64-virt.args
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-riscv64 \
+-name riscv64 \
+-S \
+-machine virt,accel=tcg,usb=off,dump-guest-core=off \
+-m 2048 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid fd65fc03-8838-4c4d-9d8d-395802488790 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-riscv64/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot c \
+-kernel /var/lib/libvirt/images/bbl \
+-append 'console=ttyS0 ro root=/dev/vda' \
+-drive file=/var/lib/libvirt/images/stage4-disk.img,format=raw,if=none,\
+id=drive-virtio-disk0 \
+-device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \
+-chardev pty,id=charserial0 \
+-serial chardev:charserial0
diff --git a/tests/qemuxml2argvdata/riscv64-virt.xml b/tests/qemuxml2argvdata/riscv64-virt.xml
new file mode 100644
index 0000000000..0b6d668ebe
--- /dev/null
+++ b/tests/qemuxml2argvdata/riscv64-virt.xml
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+  <name>riscv64</name>
+  <uuid>fd65fc03-8838-4c4d-9d8d-395802488790</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='riscv64' machine='virt'>hvm</type>
+    <kernel>/var/lib/libvirt/images/bbl</kernel>
+    <cmdline>console=ttyS0 ro root=/dev/vda</cmdline>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-riscv64</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/var/lib/libvirt/images/stage4-disk.img'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='virtio-mmio'/>
+    </disk>
+    <serial type='pty'>
+      <target type='system-serial' port='0'>
+        <model name='ns16550a'/>
+      </target>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 042ee12aaa..b02d70a854 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2843,6 +2843,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW,
             QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW);
 
+    DO_TEST("riscv64-virt", NONE);
+
     if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
         virFileDeleteTree(fakerootdir);
 
diff --git a/tests/qemuxml2startupxmloutdata/riscv64-virt.xml b/tests/qemuxml2startupxmloutdata/riscv64-virt.xml
new file mode 100644
index 0000000000..f635862792
--- /dev/null
+++ b/tests/qemuxml2startupxmloutdata/riscv64-virt.xml
@@ -0,0 +1,37 @@
+<domain type='qemu'>
+  <name>riscv64</name>
+  <uuid>fd65fc03-8838-4c4d-9d8d-395802488790</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='riscv64' machine='virt'>hvm</type>
+    <kernel>/var/lib/libvirt/images/bbl</kernel>
+    <cmdline>console=ttyS0 ro root=/dev/vda</cmdline>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-riscv64</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/var/lib/libvirt/images/stage4-disk.img'/>
+      <target dev='vda' bus='virtio'/>
+      <alias name='virtio-disk0'/>
+      <address type='virtio-mmio'/>
+    </disk>
+    <serial type='pty'>
+      <target type='system-serial' port='0'>
+        <model name='ns16550a'/>
+      </target>
+      <alias name='serial0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+      <alias name='serial0'/>
+    </console>
+  </devices>
+</domain>
-- 
2.17.0




More information about the libvir-list mailing list