]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Add tests for virtio-rng device handling
authorPeter Krempa <pkrempa@redhat.com>
Tue, 12 Feb 2013 16:56:00 +0000 (17:56 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 25 Feb 2013 09:58:04 +0000 (10:58 +0100)
Adds XML parsing and qemu commandline tests for the VirtIO RNG device
support.

tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-egd.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-egd.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmltest.c

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-egd.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-egd.args
new file mode 100644 (file)
index 0000000..d40f0b5
--- /dev/null
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -chardev socket,id=charrng0,host=1.2.3.4,port=1234 -object rng-egd,chardev=charrng0,id=rng0 -device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-egd.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-egd.xml
new file mode 100644 (file)
index 0000000..4e52a32
--- /dev/null
@@ -0,0 +1,26 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <controller type='usb' index='0'/>
+    <memballoon model='virtio'/>
+    <rng model='virtio'>
+      <backend model='egd' type='tcp'>
+        <source mode='connect' host='1.2.3.4' service='1234'/>
+        <protocol type='raw'/>
+      </backend>
+    </rng>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args
new file mode 100644 (file)
index 0000000..4611ae5
--- /dev/null
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -object rng-random,id=rng0,filename=/test/phile -device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.xml
new file mode 100644 (file)
index 0000000..ab1f38c
--- /dev/null
@@ -0,0 +1,23 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <controller type='usb' index='0'/>
+    <memballoon model='virtio'/>
+    <rng model='virtio'>
+      <backend model='random'>/test/phile</backend>
+    </rng>
+  </devices>
+</domain>
index 43570689cfb29df93fdb7316c8f9bf43475dd000..b6b5489a69f86855f559fa1a15f692b99695ce14 100644 (file)
@@ -882,6 +882,11 @@ mymain(void)
             QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
             QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL_VGA);
 
+    DO_TEST("virtio-rng-random", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG,
+            QEMU_CAPS_OBJECT_RNG_RANDOM);
+    DO_TEST("virtio-rng-egd", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG,
+            QEMU_CAPS_OBJECT_RNG_EGD);
+
     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);
     VIR_FREE(map);
index 3f3689611ee41787038f6cc1f606aec4a15cb9aa..d64960fbc3bf22b1a20eb0ad759ef6f5a5365281 100644 (file)
@@ -242,6 +242,9 @@ mymain(void)
 
     DO_TEST("disk-scsi-disk-vpd");
 
+    DO_TEST("virtio-rng-random");
+    DO_TEST("virtio-rng-egd");
+
     /* These tests generate different XML */
     DO_TEST_DIFFERENT("balloon-device-auto");
     DO_TEST_DIFFERENT("channel-virtio-auto");