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