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(a)redhat.com>
---
.../cpu-translation.x86_64-4.0.0.args | 36 +++++++++++++++++++
.../cpu-translation.x86_64-latest.args | 36 +++++++++++++++++++
tests/qemuxml2argvdata/cpu-translation.xml | 34 ++++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
4 files changed, 108 insertions(+)
create mode 100644 tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
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-4.0.0.args
b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
new file mode 100644
index 0000000000..f8e19fca24
--- /dev/null
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
@@ -0,0 +1,36 @@
+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-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-i440fx-4.0,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,kvm_pv_eoi=on,\
+kvm_pv_unhalt=on \
+-m 214 \
+-overcommit mem-lock=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.x86_64-latest.args
b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
new file mode 100644
index 0000000000..7a1546fb36
--- /dev/null
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
@@ -0,0 +1,36 @@
+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-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,kvm_pv_eoi=on,\
+kvm_pv_unhalt=on \
+-m 214 \
+-overcommit mem-lock=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 787d435fb9..90a35e7fd6 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1693,6 +1693,8 @@ 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_VER("cpu-translation", "4.0.0");
+ 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