render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From db94d82338e66a7f238e5f19c317fede75186ad4 Mon Sep 17 00:00:00 2001
Message-Id: <db94d82338e66a7f238e5f19c317fede75186ad4@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 9 Aug 2016 15:03:20 +0200
Subject: [PATCH] tests: Add a test for host-model CPU with CMT feature

The generated command line wouldn't work since QEMU doesn't know what
'cmt' is. The following patch will fix this issue.

https://bugzilla.redhat.com/show_bug.cgi?id=1355857

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 58ba240df89a7dd7bff16ebb65d9aadd49fb8bbb)

RHEL changes:
    - since commit v2.0.0-8-g0c8ec3b libvirt in RHEL always passes
      +rtm,+hle options to Haswell and Broadwell CPUs
    - downstream does not assume QEMU_CAPS_SMP_TOPOLOGY

https://bugzilla.redhat.com/show_bug.cgi?id=1365500

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 .../qemuxml2argv-cpu-host-model-cmt.args           | 22 ++++++++++++++++++++++
 .../qemuxml2argv-cpu-host-model-cmt.xml            | 19 +++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  1 +
 tests/testutilsqemu.c                              |  1 +
 4 files changed, 43 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.args
new file mode 100644
index 0000000..884ca57
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.args
@@ -0,0 +1,22 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
++smx,+est,+tm2,+xtpr,+pdcm,+osxsave,+f16c,+rdrand,+cmt,+pdpe1gb,+abm,+rtm,+hle \
+-m 214 \
+-smp 6 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-no-acpi \
+-boot n \
+-usb \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.xml
new file mode 100644
index 0000000..7e3f617
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.xml
@@ -0,0 +1,19 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu mode='host-model'/>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 95474e8..927728e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1391,6 +1391,7 @@ mymain(void)
     DO_TEST("cpu-Haswell2", QEMU_CAPS_KVM);
     DO_TEST("cpu-Haswell3", QEMU_CAPS_KVM);
     DO_TEST("cpu-Haswell-noTSX", QEMU_CAPS_KVM);
+    DO_TEST("cpu-host-model-cmt", NONE);
     driver.caps->host.cpu = cpuDefault;
 
     DO_TEST("encrypted-disk", NONE);
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 1cf72a9..f41b0b6 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -54,6 +54,7 @@ static virCPUFeatureDef cpuHaswellFeatures[] = {
     { (char *) "invtsc",    -1 },
     { (char *) "abm",       -1 },
     { (char *) "pdpe1gb",   -1 },
+    { (char *) "cmt",       -1 },
     { (char *) "rdrand",    -1 },
     { (char *) "f16c",      -1 },
     { (char *) "osxsave",   -1 },
-- 
2.9.2