[libvirt PATCH 09/10] tests: Add tests for hyperv-passthrough

Tim Wiederhake twiederh at redhat.com
Fri Nov 26 14:35:01 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 .../hyperv-passthrough.x86_64-6.1.0.args      | 32 +++++++++++++++++++
 .../hyperv-passthrough.x86_64-latest.args     | 32 +++++++++++++++++++
 tests/qemuxml2argvdata/hyperv-passthrough.xml | 27 ++++++++++++++++
 tests/qemuxml2argvtest.c                      |  2 ++
 .../qemuxml2xmloutdata/hyperv-passthrough.xml | 31 ++++++++++++++++++
 tests/qemuxml2xmltest.c                       |  1 +
 6 files changed, 125 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/hyperv-passthrough.x86_64-6.1.0.args
 create mode 100644 tests/qemuxml2argvdata/hyperv-passthrough.x86_64-latest.args
 create mode 100644 tests/qemuxml2argvdata/hyperv-passthrough.xml
 create mode 100644 tests/qemuxml2xmloutdata/hyperv-passthrough.xml

diff --git a/tests/qemuxml2argvdata/hyperv-passthrough.x86_64-6.1.0.args b/tests/qemuxml2argvdata/hyperv-passthrough.x86_64-6.1.0.args
new file mode 100644
index 0000000000..87755b5042
--- /dev/null
+++ b/tests/qemuxml2argvdata/hyperv-passthrough.x86_64-6.1.0.args
@@ -0,0 +1,32 @@
+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 \
+/usr/bin/qemu-system-i386 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc-i440fx-6.1,usb=off,dump-guest-core=off,memory-backend=pc.ram \
+-accel tcg \
+-cpu qemu64,hv-passthrough=on \
+-m 214 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 6,sockets=6,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/hyperv-passthrough.x86_64-latest.args b/tests/qemuxml2argvdata/hyperv-passthrough.x86_64-latest.args
new file mode 100644
index 0000000000..aab8c09d71
--- /dev/null
+++ b/tests/qemuxml2argvdata/hyperv-passthrough.x86_64-latest.args
@@ -0,0 +1,32 @@
+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 \
+/usr/bin/qemu-system-i386 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
+-accel tcg \
+-cpu qemu64,hv-passthrough=on \
+-m 214 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 6,sockets=6,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/hyperv-passthrough.xml b/tests/qemuxml2argvdata/hyperv-passthrough.xml
new file mode 100644
index 0000000000..9d6a872a41
--- /dev/null
+++ b/tests/qemuxml2argvdata/hyperv-passthrough.xml
@@ -0,0 +1,27 @@
+<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'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <hyperv mode='passthrough'/>
+  </features>
+  <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='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b3fa676af7..94b0025281 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1217,6 +1217,8 @@ mymain(void)
     DO_TEST_CAPS_LATEST("hyperv-off");
     DO_TEST_CAPS_VER("hyperv-panic", "4.0.0");
     DO_TEST_CAPS_LATEST("hyperv-panic");
+    DO_TEST_CAPS_VER("hyperv-passthrough", "6.1.0");
+    DO_TEST_CAPS_LATEST("hyperv-passthrough");
     DO_TEST_CAPS_LATEST("hyperv-stimer-direct");
 
     DO_TEST_NOCAPS("kvm-features");
diff --git a/tests/qemuxml2xmloutdata/hyperv-passthrough.xml b/tests/qemuxml2xmloutdata/hyperv-passthrough.xml
new file mode 100644
index 0000000000..f833860997
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/hyperv-passthrough.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'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <hyperv mode='passthrough'>
+    </hyperv>
+  </features>
+  <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'/>
+    <audio id='1' type='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b535cda187..b229fbb14f 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -260,6 +260,7 @@ mymain(void)
     DO_TEST_NOCAPS("hyperv");
     DO_TEST_NOCAPS("hyperv-off");
     DO_TEST_NOCAPS("hyperv-panic");
+    DO_TEST_NOCAPS("hyperv-passthrough");
     DO_TEST_NOCAPS("hyperv-stimer-direct");
 
     DO_TEST_NOCAPS("kvm-features");
-- 
2.31.1




More information about the libvir-list mailing list