[libvirt] [PATCHv3 5/5] S390: Adding testcases for s390

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Fri Jun 29 15:02:07 UTC 2012


Add minimal s390-virtio domain testcase and testcases for virtio serial,
net, disk for the virtio-s390 bus.

Signed-off-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
---
 .../qemuxml2argv-console-virtio-s390.args          |    9 ++++++
 .../qemuxml2argv-console-virtio-s390.xml           |   24 +++++++++++++++
 .../qemuxml2argv-disk-virtio-s390.args             |    5 +++
 .../qemuxml2argv-disk-virtio-s390.xml              |   22 ++++++++++++++
 .../qemuxml2argv-minimal-s390.args                 |    5 +++
 .../qemuxml2argvdata/qemuxml2argv-minimal-s390.xml |   21 +++++++++++++
 .../qemuxml2argv-net-virtio-s390.args              |    5 +++
 .../qemuxml2argv-net-virtio-s390.xml               |   22 ++++++++++++++
 tests/qemuxml2argvtest.c                           |    8 +++++
 tests/testutilsqemu.c                              |   31 ++++++++++++++++++++
 10 files changed, 152 insertions(+), 0 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args
new file mode 100644
index 0000000..3388a35
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
+s390-virtio -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \
+socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \
+chardev=charmonitor,id=monitor,mode=readline -no-acpi \
+-boot c -device virtio-serial-s390,id=virtio-serial0 \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 \
+-chardev pty,id=charconsole0 \
+-device virtconsole,chardev=charconsole0,id=console0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml
new file mode 100644
index 0000000..5a4a9d4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml
@@ -0,0 +1,24 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219100</memory>
+  <currentMemory>219100</currentMemory>
+  <os>
+    <type arch='s390x' machine='s390-virtio'>hvm</type>
+    <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</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='virtio'/>
+    </disk>
+    <console type='pty'>
+      <target type='virtio'/>
+    </console>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args
new file mode 100644
index 0000000..66bdf1e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \
+-M s390-virtio -m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml
new file mode 100644
index 0000000..9ce6c18
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml
@@ -0,0 +1,22 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219136</memory>
+  <currentMemory>219136</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-virtio'>hvm</type>
+    <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</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='virtio'/>
+    </disk>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args
new file mode 100644
index 0000000..4e7bf05
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
+-name QEMUGuest1 -S -M s390-virtio -m 214 -smp 1 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi \
+-boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \
+none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml
new file mode 100644
index 0000000..7378bd4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml
@@ -0,0 +1,21 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219100</memory>
+  <currentMemory>219100</currentMemory>
+  <os>
+    <type arch='s390x' machine='s390-virtio'>hvm</type>
+    <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</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='virtio'/>
+    </disk>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args
new file mode 100644
index 0000000..700ea84
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \
+-M s390-virtio -m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device virtio-net-s390,vlan=0,id=net0,mac=00:11:22:33:44:55 \
+-net user,vlan=0,name=hostnet0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml
new file mode 100644
index 0000000..f42fadd
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml
@@ -0,0 +1,22 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219136</memory>
+  <currentMemory>219136</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-virtio'>hvm</type>
+    <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</emulator>
+    <interface type='user'>
+      <mac address='00:11:22:33:44:55'/>
+      <model type='virtio'/>
+    </interface>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index cda32b6..a4fa8fe 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -341,6 +341,7 @@ mymain(void)
     unsetenv("SDL_AUDIODRIVER");
 
     DO_TEST("minimal", false, QEMU_CAPS_NAME);
+    DO_TEST("minimal-s390", false, QEMU_CAPS_NAME);
     DO_TEST("machine-aliases1", false, NONE);
     DO_TEST("machine-aliases2", true, NONE);
     DO_TEST("boot-cdrom", false, NONE);
@@ -393,6 +394,8 @@ mymain(void)
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE);
     DO_TEST("disk-many", false, NONE);
     DO_TEST("disk-virtio", false, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
+    DO_TEST("disk-virtio-s390", false, QEMU_CAPS_DRIVE,
+            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_S390);
     DO_TEST("disk-order", false,
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE_BOOT,
             QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
@@ -552,6 +555,8 @@ mymain(void)
             QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_TX_ALG);
     DO_TEST("net-virtio-netdev", false,
             QEMU_CAPS_DEVICE, QEMU_CAPS_NETDEV, QEMU_CAPS_NODEFCONFIG);
+    DO_TEST("net-virtio-s390", false,
+            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_S390);
     DO_TEST("net-eth", false, NONE);
     DO_TEST("net-eth-ifname", false, NONE);
     DO_TEST("net-eth-names", false, QEMU_CAPS_NET_NAME);
@@ -609,6 +614,9 @@ mymain(void)
             QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
     DO_TEST("console-virtio-many", false,
             QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
+    DO_TEST("console-virtio-s390", false,
+            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_DRIVE,  QEMU_CAPS_VIRTIO_S390);
     DO_TEST("channel-spicevmc", false,
             QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 8d5a3bf..74b9122 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -87,6 +87,34 @@ error:
     return -1;
 }
 
+static int testQemuAddS390Guest(virCapsPtr caps)
+{
+    static const char *s390_machines[] = { "s390-virtio"};
+    virCapsGuestMachinePtr *machines = NULL;
+    virCapsGuestPtr guest;
+
+    machines = virCapabilitiesAllocMachines(s390_machines,
+                                            ARRAY_CARDINALITY(s390_machines));
+    if (!machines)
+        goto error;
+
+    guest = virCapabilitiesAddGuest(caps, "hvm", "s390x", 64,
+                                    "/usr/bin/qemu-system-s390x", NULL,
+                                    ARRAY_CARDINALITY(s390_machines),
+                                    machines);
+    if (!guest)
+        goto error;
+
+    if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
+        goto error;
+
+    return 0;
+
+error:
+    virCapabilitiesFreeMachines(machines, ARRAY_CARDINALITY(s390_machines));
+    return -1;
+}
+
 virCapsPtr testQemuCapsInit(void) {
     virCapsPtr caps;
     virCapsGuestPtr guest;
@@ -208,6 +236,9 @@ virCapsPtr testQemuCapsInit(void) {
     if (testQemuAddPPC64Guest(caps))
         goto cleanup;
 
+    if (testQemuAddS390Guest(caps))
+        goto cleanup;
+
     if (virTestGetDebug()) {
         char *caps_str;
 
-- 
1.7.0.4




More information about the libvir-list mailing list