[PATCH v2 10/11] tests: qemu capabilites: qemu 2.7 and 2.8 on s390x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Collin L. Walling" <walling@xxxxxxxxxxxxxxxxxx>

Tests Qemu capabilities on s390x before and after the availability of
the query-cpu-model-expansion QMP command. The host CPU is mocked to use
the zEC12.2-base model for these tests, which has a defined set of features
expected to be available on this model.

Signed-off-by: Collin L. Walling <walling@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Jason J. Herne <jjherne@xxxxxxxxxxxxxxxxxx>
---
 tests/qemucapabilitiestest.c |  4 ++++
 tests/testutilsqemu.c        | 39 ++++++++++++++++++++++++++++++++++++++-
 tests/testutilsqemu.h        |  1 +
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
index 51d0cc4..1214d7c 100644
--- a/tests/qemucapabilitiestest.c
+++ b/tests/qemucapabilitiestest.c
@@ -172,6 +172,10 @@ mymain(void)
     DO_TEST("aarch64", "caps_2.6.0-gicv2");
     DO_TEST("aarch64", "caps_2.6.0-gicv3");
     DO_TEST("ppc64le", "caps_2.6.0");
+    qemuTestSetHostCPU(driver.caps, cpuS390zEC12_2_base);
+    DO_TEST("s390x", "caps_2.7.0");
+    DO_TEST("s390x", "caps_2.8.0");
+    qemuTestSetHostCPU(driver.caps, NULL);
 
     /*
      * Run "tests/qemucapsprobe /path/to/qemu/binary >foo.replies"
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 56a89c9..a93987e 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -17,6 +17,7 @@
 virCPUDefPtr cpuDefault;
 virCPUDefPtr cpuHaswell;
 virCPUDefPtr cpuPower8;
+virCPUDefPtr cpuS390zEC12_2_base;
 
 static virCPUFeatureDef cpuDefaultFeatures[] = {
     { (char *) "ds",        -1 },
@@ -93,6 +94,40 @@ static virCPUDef cpuHaswellData = {
     cpuHaswellFeatures,     /* features */
 };
 
+static virCPUFeatureDef cpuS390zEC12_2_base_Features[] = {
+    { (char *) "aefsi",     -1 },
+    { (char *) "msa5",      -1 },
+    { (char *) "msa4",      -1 },
+    { (char *) "msa3",      -1 },
+    { (char *) "msa2",      -1 },
+    { (char *) "msa1",      -1 },
+    { (char *) "sthyi",     -1 },
+    { (char *) "edat",      -1 },
+    { (char *) "ri",        -1 },
+    { (char *) "edat2",     -1 },
+    { (char *) "ipter",     -1 },
+    { (char *) "esop",      -1 },
+    { (char *) "cte",       -1 },
+    { (char *) "te",        -1 },
+    { (char *) "cmm",       -1 },
+};
+static virCPUDef cpuS390zEC12_2_base_Data = {
+    VIR_CPU_TYPE_HOST,      /* type */
+    0,                      /* mode */
+    0,                      /* match */
+    VIR_ARCH_S390X,         /* arch */
+    (char *) "zEC12-base",  /* model */
+    NULL,                   /* vendor_id */
+    0,                      /* fallback */
+    NULL,                   /* vendor */
+    1,                      /* sockets */
+    1,                      /* cores */
+    1,                      /* threads */
+    ARRAY_CARDINALITY(cpuS390zEC12_2_base_Features), /* nfeatures */
+    ARRAY_CARDINALITY(cpuS390zEC12_2_base_Features), /* nfeatures_max */
+    cpuS390zEC12_2_base_Features,     /* features */
+};
+
 static virCPUDef cpuPower8Data = {
     .type = VIR_CPU_TYPE_HOST,
     .arch = VIR_ARCH_PPC64,
@@ -342,7 +377,8 @@ virCapsPtr testQemuCapsInit(void)
 
     if (!(cpuDefault = virCPUDefCopy(&cpuDefaultData)) ||
         !(cpuHaswell = virCPUDefCopy(&cpuHaswellData)) ||
-        !(cpuPower8 = virCPUDefCopy(&cpuPower8Data)))
+        !(cpuPower8 = virCPUDefCopy(&cpuPower8Data)) ||
+        !(cpuS390zEC12_2_base = virCPUDefCopy(&cpuS390zEC12_2_base_Data)))
         goto cleanup;
 
     qemuTestSetHostCPU(caps, NULL);
@@ -455,6 +491,7 @@ virCapsPtr testQemuCapsInit(void)
     virCPUDefFree(cpuDefault);
     virCPUDefFree(cpuHaswell);
     virCPUDefFree(cpuPower8);
+    virCPUDefFree(cpuS390zEC12_2_base);
     virObjectUnref(caps);
     return NULL;
 }
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index 047a64d..3c62466 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -21,6 +21,7 @@ virQEMUCapsPtr qemuTestParseCapabilities(virCapsPtr caps,
 extern virCPUDefPtr cpuDefault;
 extern virCPUDefPtr cpuHaswell;
 extern virCPUDefPtr cpuPower8;
+extern virCPUDefPtr cpuS390zEC12_2_base;
 
 void qemuTestSetHostArch(virCapsPtr caps,
                         virArch arch);
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux