Signed-off-by: Han Han <hhan(a)redhat.com>
---
.../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 +
.../qemu_4.2.0-virt.aarch64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.aarch64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 +
.../caps_4.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 +
.../caps_4.2.0.x86_64.xml | 1 +
.../qemuxml2argvdata/virtio-rng-builtin.args | 30 ++++++++++++++++++
tests/qemuxml2argvdata/virtio-rng-builtin.xml | 26 ++++++++++++++++
tests/qemuxml2argvtest.c | 3 ++
.../qemuxml2xmloutdata/virtio-rng-builtin.xml | 31 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 ++
16 files changed, 103 insertions(+)
create mode 100644 tests/qemuxml2argvdata/virtio-rng-builtin.args
create mode 100644 tests/qemuxml2argvdata/virtio-rng-builtin.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-rng-builtin.xml
diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
index c4c6bfb5..eaa3b756 100644
--- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
@@ -167,6 +167,7 @@
<enum name='backendModel'>
<value>random</value>
<value>egd</value>
+ <value>builtin</value>
</enum>
</rng>
</devices>
diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
index a7f8d9c5..af482e38 100644
--- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
@@ -178,6 +178,7 @@
<enum name='backendModel'>
<value>random</value>
<value>egd</value>
+ <value>builtin</value>
</enum>
</rng>
</devices>
diff --git a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml
b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml
index e5954717..908406bf 100644
--- a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml
@@ -136,6 +136,7 @@
<enum name='backendModel'>
<value>random</value>
<value>egd</value>
+ <value>builtin</value>
</enum>
</rng>
</devices>
diff --git a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml
b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml
index bb02b1d8..c66550ce 100644
--- a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml
@@ -134,6 +134,7 @@
<enum name='backendModel'>
<value>random</value>
<value>egd</value>
+ <value>builtin</value>
</enum>
</rng>
</devices>
diff --git a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml
b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml
index 6d3ada37..7906482e 100644
--- a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml
@@ -100,6 +100,7 @@
<enum name='backendModel'>
<value>random</value>
<value>egd</value>
+ <value>builtin</value>
</enum>
</rng>
</devices>
diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml
b/tests/domaincapsdata/qemu_4.2.0.s390x.xml
index c6d92542..0cdfd435 100644
--- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml
@@ -191,6 +191,7 @@
<enum name='backendModel'>
<value>random</value>
<value>egd</value>
+ <value>builtin</value>
</enum>
</rng>
</devices>
diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
index f0e0f182..c82d12d3 100644
--- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
@@ -167,6 +167,7 @@
<enum name='backendModel'>
<value>random</value>
<value>egd</value>
+ <value>builtin</value>
</enum>
</rng>
</devices>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
index a6469073..b4363670 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
@@ -175,6 +175,7 @@
<flag name='blockdev-file-dynamic-auto-read-only'/>
<flag name='savevm-monitor-nodes'/>
<flag name='drive-nvme'/>
+ <flag name='rng-builtin'/>
<version>4001050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
index ee9fb236..9b22e3fe 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
@@ -176,6 +176,7 @@
<flag name='machine.pseries.cap-ccf-assist'/>
<flag name='blockdev-file-dynamic-auto-read-only'/>
<flag name='drive-nvme'/>
+ <flag name='rng-builtin'/>
<version>4001050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
index fdf5cb4c..4c13f672 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
@@ -135,6 +135,7 @@
<flag name='query-cpu-model-comparison'/>
<flag name='blockdev-file-dynamic-auto-read-only'/>
<flag name='drive-nvme'/>
+ <flag name='rng-builtin'/>
<version>4001050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>39100242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
index 4857e2f5..93de5c37 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
@@ -218,6 +218,7 @@
<flag name='blockdev-file-dynamic-auto-read-only'/>
<flag name='savevm-monitor-nodes'/>
<flag name='drive-nvme'/>
+ <flag name='rng-builtin'/>
<version>4002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>
diff --git a/tests/qemuxml2argvdata/virtio-rng-builtin.args
b/tests/qemuxml2argvdata/virtio-rng-builtin.args
new file mode 100644
index 00000000..242129ee
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-rng-builtin.args
@@ -0,0 +1,30 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
+-object rng-builtin,id=objrng0 \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/virtio-rng-builtin.xml
b/tests/qemuxml2argvdata/virtio-rng-builtin.xml
new file mode 100644
index 00000000..39bad092
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-rng-builtin.xml
@@ -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-system-i386</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'/>
+ <rng model='virtio'>
+ <backend model='builtin'/>
+ </rng>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index bfbed5c3..e3579b2e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2119,6 +2119,9 @@ mymain(void)
DO_TEST("virtio-rng-egd",
QEMU_CAPS_DEVICE_VIRTIO_RNG,
QEMU_CAPS_OBJECT_RNG_EGD);
+ DO_TEST("virtio-rng-builtin",
+ QEMU_CAPS_DEVICE_VIRTIO_RNG,
+ QEMU_CAPS_OBJECT_RNG_BUILTIN);
DO_TEST_CAPS_VER("virtio-rng-egd-unix", "2.5.0");
DO_TEST_CAPS_LATEST("virtio-rng-egd-unix");
DO_TEST("virtio-rng-multiple",
diff --git a/tests/qemuxml2xmloutdata/virtio-rng-builtin.xml
b/tests/qemuxml2xmloutdata/virtio-rng-builtin.xml
new file mode 100644
index 00000000..ba5b0cad
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/virtio-rng-builtin.xml
@@ -0,0 +1,31 @@
+<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-system-i386</emulator>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </memballoon>
+ <rng model='virtio'>
+ <backend model='builtin'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x0'/>
+ </rng>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 34c2ec8c..a18682e3 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -629,6 +629,8 @@ mymain(void)
QEMU_CAPS_DEVICE_VIRTIO_RNG);
DO_TEST("virtio-rng-egd",
QEMU_CAPS_DEVICE_VIRTIO_RNG);
+ DO_TEST("virtio-rng-builtin",
+ QEMU_CAPS_DEVICE_VIRTIO_RNG);
DO_TEST("pseries-nvram",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
--
2.23.0