libvirt/SOURCES/libvirt-qemuxml2argvtest-Add-test-for-CPU-features-translation.patch
2021-09-10 11:57:18 +00:00

135 lines
4.8 KiB
Diff

From 3ddc4c63f770fa6e2b2e37915c3f70598aa59d97 Mon Sep 17 00:00:00 2001
Message-Id: <3ddc4c63f770fa6e2b2e37915c3f70598aa59d97@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 21 Jun 2019 09:25:50 +0200
Subject: [PATCH] qemuxml2argvtest: Add test for CPU features translation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This should cover all CPU features for which QEMU prefers spelling that
differs from the one used by libvirt.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 24aa210d90770a6ea2313ebf2047c0a802932dca)
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
Conflicts:
tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
- old command line
- downstream patch to add rtm=on and hle=on for Haswell
tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
- dropped as there are no 4.0.0 capabilities downstream
tests/qemuxml2argvtest.c
- dropped cpu-translation test with QEMU 4.0.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <6ce0d74bdf9a66c0908fd8162902b1f75870189b.1561068591.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
.../cpu-translation.x86_64-latest.args | 33 ++++++++++++++++++
tests/qemuxml2argvdata/cpu-translation.xml | 34 +++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
3 files changed, 68 insertions(+)
create mode 100644 tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/cpu-translation.xml
diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
new file mode 100644
index 0000000000..898b987086
--- /dev/null
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
@@ -0,0 +1,33 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-cpu Haswell,pclmuldq=on,ds_cpl=on,tsc_adjust=on,fxsr_opt=on,lahf_lm=on,\
+cmp_legacy=on,nodeid_msr=on,perfctr_core=on,perfctr_nb=on,rtm=on,hle=on,\
+kvm_pv_eoi=on,kvm_pv_unhalt=on \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-fade-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/cpu-translation.xml b/tests/qemuxml2argvdata/cpu-translation.xml
new file mode 100644
index 0000000000..4054f3d3be
--- /dev/null
+++ b/tests/qemuxml2argvdata/cpu-translation.xml
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-fade-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='network'/>
+ </os>
+ <features>
+ <apic eoi='on'/>
+ <pvspinlock state='on'/>
+ </features>
+ <cpu mode='custom'>
+ <model fallback='forbid'>Haswell</model>
+ <feature name='pclmuldq' policy='require'/>
+ <feature name='ds_cpl' policy='require'/>
+ <feature name='tsc_adjust' policy='require'/>
+ <feature name='fxsr_opt' policy='require'/>
+ <feature name='lahf_lm' policy='require'/>
+ <feature name='cmp_legacy' policy='require'/>
+ <feature name='nodeid_msr' policy='require'/>
+ <feature name='perfctr_core' policy='require'/>
+ <feature name='perfctr_nb' policy='require'/>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 9de0cbf7e9..03d6a60736 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1741,6 +1741,7 @@ mymain(void)
DO_TEST("cpu-Haswell-noTSX", QEMU_CAPS_KVM);
DO_TEST("cpu-host-model-cmt", NONE);
DO_TEST("cpu-tsc-frequency", QEMU_CAPS_KVM);
+ DO_TEST_CAPS_LATEST("cpu-translation");
qemuTestSetHostCPU(driver.caps, NULL);
DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
--
2.22.0