render / rpms / libvirt

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