From 825516e6e3ed027938db3fd3d9fe62332b40352b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kamil=20Szcz=C4=99k?= Date: Mon, 19 Aug 2024 01:19:55 +0000 Subject: [PATCH] qemuxmlconftest: Add test cases for the new 'ps2' feature MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Introduce tests to verify that the 'ps2' feature is correctly parsed when given either 'dirty' XML from a user or 'clean' canonical XML, as produced by libvirt. This also tests the transformation from libvirt's internal state to the aforementioned canonical form and to a QEMU command line. As a bonus, we also test some known bad configurations: - When user explicitly adds ps2 bus inputs, but also explicitly disables the 'ps2' feature. - When user explicitly enables the 'vmport' feature, but also explicitly disables the 'ps2' feature. This is not supported by QEMU and will result in vmport device not being created without emitting any warning or error. Signed-off-by: Kamil Szczęk Reviewed-by: Michal Privoznik --- ...-off-explicit-ps2-inputs.x86_64-latest.err | 1 + .../machine-i8042-off-explicit-ps2-inputs.xml | 19 +++++++++++ ...hine-i8042-off-vmport-on.x86_64-latest.err | 1 + .../machine-i8042-off-vmport-on.xml | 18 ++++++++++ .../machine-i8042-off.x86_64-6.2.0.err | 1 + .../machine-i8042-off.x86_64-latest.args | 33 ++++++++++++++++++ .../machine-i8042-off.x86_64-latest.xml | 32 +++++++++++++++++ tests/qemuxmlconfdata/machine-i8042-off.xml | 17 ++++++++++ .../machine-i8042-on.x86_64-6.2.0.err | 1 + .../machine-i8042-on.x86_64-latest.args | 33 ++++++++++++++++++ .../machine-i8042-on.x86_64-latest.xml | 34 +++++++++++++++++++ tests/qemuxmlconfdata/machine-i8042-on.xml | 17 ++++++++++ tests/qemuxmlconftest.c | 6 ++++ 13 files changed, 213 insertions(+) create mode 100644 tests/qemuxmlconfdata/machine-i8042-off-explicit-ps2-inputs.x86_64-latest.err create mode 100644 tests/qemuxmlconfdata/machine-i8042-off-explicit-ps2-inputs.xml create mode 100644 tests/qemuxmlconfdata/machine-i8042-off-vmport-on.x86_64-latest.err create mode 100644 tests/qemuxmlconfdata/machine-i8042-off-vmport-on.xml create mode 100644 tests/qemuxmlconfdata/machine-i8042-off.x86_64-6.2.0.err create mode 100644 tests/qemuxmlconfdata/machine-i8042-off.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/machine-i8042-off.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/machine-i8042-off.xml create mode 100644 tests/qemuxmlconfdata/machine-i8042-on.x86_64-6.2.0.err create mode 100644 tests/qemuxmlconfdata/machine-i8042-on.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/machine-i8042-on.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/machine-i8042-on.xml diff --git a/tests/qemuxmlconfdata/machine-i8042-off-explicit-ps2-inputs.x86_64-latest.err b/tests/qemuxmlconfdata/machine-i8042-off-explicit-ps2-inputs.x86_64-latest.err new file mode 100644 index 0000000000..4fed60aa37 --- /dev/null +++ b/tests/qemuxmlconfdata/machine-i8042-off-explicit-ps2-inputs.x86_64-latest.err @@ -0,0 +1 @@ +unsupported configuration: ps2 bus inputs require the ps2 feature not to be disabled diff --git a/tests/qemuxmlconfdata/machine-i8042-off-explicit-ps2-inputs.xml b/tests/qemuxmlconfdata/machine-i8042-off-explicit-ps2-inputs.xml new file mode 100644 index 0000000000..f90677670b --- /dev/null +++ b/tests/qemuxmlconfdata/machine-i8042-off-explicit-ps2-inputs.xml @@ -0,0 +1,19 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 1 + + hvm + + + + + + /usr/bin/qemu-system-x86_64 + + + + + + diff --git a/tests/qemuxmlconfdata/machine-i8042-off-vmport-on.x86_64-latest.err b/tests/qemuxmlconfdata/machine-i8042-off-vmport-on.x86_64-latest.err new file mode 100644 index 0000000000..0c3b7280c0 --- /dev/null +++ b/tests/qemuxmlconfdata/machine-i8042-off-vmport-on.x86_64-latest.err @@ -0,0 +1 @@ +unsupported configuration: vmport feature requires the ps2 feature not to be disabled diff --git a/tests/qemuxmlconfdata/machine-i8042-off-vmport-on.xml b/tests/qemuxmlconfdata/machine-i8042-off-vmport-on.xml new file mode 100644 index 0000000000..957da054b8 --- /dev/null +++ b/tests/qemuxmlconfdata/machine-i8042-off-vmport-on.xml @@ -0,0 +1,18 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 1 + + hvm + + + + + + + /usr/bin/qemu-system-x86_64 + + + + diff --git a/tests/qemuxmlconfdata/machine-i8042-off.x86_64-6.2.0.err b/tests/qemuxmlconfdata/machine-i8042-off.x86_64-6.2.0.err new file mode 100644 index 0000000000..3a12712915 --- /dev/null +++ b/tests/qemuxmlconfdata/machine-i8042-off.x86_64-6.2.0.err @@ -0,0 +1 @@ +unsupported configuration: ps2 feature state cannot be controlled with this QEMU binary diff --git a/tests/qemuxmlconfdata/machine-i8042-off.x86_64-latest.args b/tests/qemuxmlconfdata/machine-i8042-off.x86_64-latest.args new file mode 100644 index 0000000000..e340d164fc --- /dev/null +++ b/tests/qemuxmlconfdata/machine-i8042-off.x86_64-latest.args @@ -0,0 +1,33 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine q35,usb=off,i8042=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \ +-accel tcg \ +-cpu qemu64 \ +-m size=219136k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ +-overcommit mem-lock=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,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-global ICH9-LPC.noreboot=off \ +-watchdog-action reset \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/machine-i8042-off.x86_64-latest.xml b/tests/qemuxmlconfdata/machine-i8042-off.x86_64-latest.xml new file mode 100644 index 0000000000..b5c503e6df --- /dev/null +++ b/tests/qemuxmlconfdata/machine-i8042-off.x86_64-latest.xml @@ -0,0 +1,32 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + +
+ + +