7a3408
From 56e2f0e6cc2d46edde1f32cd3ef88e32f247103d Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <56e2f0e6cc2d46edde1f32cd3ef88e32f247103d@dist-git>
7a3408
From: Andrea Bolognani <abologna@redhat.com>
7a3408
Date: Tue, 11 Aug 2015 17:16:12 +0200
7a3408
Subject: [PATCH] tests: Add a bunch of cpu test case for ppc64
7a3408
7a3408
The test cases cover the cpuCompare(), cpuBaseline() and
7a3408
cpuNodeData() implementation.
7a3408
7a3408
(cherry picked from commit 818e68c5b422158f6fd3edf6f77ae82a631cb41d)
7a3408
7a3408
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1250977
7a3408
7a3408
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 tests/cputest.c                                          | 16 ++++++++++++++++
7a3408
 tests/cputestdata/ppc64-baseline-incompatible-models.xml | 14 ++++++++++++++
7a3408
 tests/cputestdata/ppc64-baseline-legacy.xml              | 14 ++++++++++++++
7a3408
 tests/cputestdata/ppc64-baseline-same-model-result.xml   |  3 +++
7a3408
 tests/cputestdata/ppc64-baseline-same-model.xml          | 14 ++++++++++++++
7a3408
 tests/cputestdata/ppc64-guest-legacy-incompatible.xml    |  3 +++
7a3408
 tests/cputestdata/ppc64-guest-legacy-invalid.xml         |  3 +++
7a3408
 tests/cputestdata/ppc64-guest-legacy.xml                 |  3 +++
7a3408
 .../ppc64-host+guest-legacy,ppc_models-result.xml        |  5 +++++
7a3408
 tests/cputestdata/ppc64-host-better.xml                  |  6 ++++++
7a3408
 tests/cputestdata/ppc64-host-incomp-arch.xml             |  6 ++++++
7a3408
 tests/cputestdata/ppc64-host-no-vendor.xml               |  5 +++++
7a3408
 tests/cputestdata/ppc64-host-worse.xml                   |  6 ++++++
7a3408
 13 files changed, 98 insertions(+)
7a3408
 create mode 100644 tests/cputestdata/ppc64-baseline-incompatible-models.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-baseline-legacy.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-baseline-same-model-result.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-baseline-same-model.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-guest-legacy-incompatible.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-guest-legacy-invalid.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-guest-legacy.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-host+guest-legacy,ppc_models-result.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-host-better.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-host-incomp-arch.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-host-no-vendor.xml
7a3408
 create mode 100644 tests/cputestdata/ppc64-host-worse.xml
7a3408
7a3408
diff --git a/tests/cputest.c b/tests/cputest.c
7a3408
index 09f690a..5992dd0 100644
7a3408
--- a/tests/cputest.c
7a3408
+++ b/tests/cputest.c
7a3408
@@ -571,6 +571,13 @@ mymain(void)
7a3408
     DO_TEST_COMPARE("x86", "host", "host-no-vendor", VIR_CPU_COMPARE_IDENTICAL);
7a3408
     DO_TEST_COMPARE("x86", "host-no-vendor", "host", VIR_CPU_COMPARE_INCOMPATIBLE);
7a3408
 
7a3408
+    DO_TEST_COMPARE("ppc64", "host", "host", VIR_CPU_COMPARE_IDENTICAL);
7a3408
+    DO_TEST_COMPARE("ppc64", "host", "host-better", VIR_CPU_COMPARE_INCOMPATIBLE);
7a3408
+    DO_TEST_COMPARE("ppc64", "host", "host-worse", VIR_CPU_COMPARE_INCOMPATIBLE);
7a3408
+    DO_TEST_COMPARE("ppc64", "host", "host-incomp-arch", VIR_CPU_COMPARE_INCOMPATIBLE);
7a3408
+    DO_TEST_COMPARE("ppc64", "host", "host-no-vendor", VIR_CPU_COMPARE_IDENTICAL);
7a3408
+    DO_TEST_COMPARE("ppc64", "host-no-vendor", "host", VIR_CPU_COMPARE_INCOMPATIBLE);
7a3408
+
7a3408
     /* guest to host comparison */
7a3408
     DO_TEST_COMPARE("x86", "host", "bogus-model", VIR_CPU_COMPARE_ERROR);
7a3408
     DO_TEST_COMPARE("x86", "host", "bogus-feature", VIR_CPU_COMPARE_ERROR);
7a3408
@@ -597,6 +604,9 @@ mymain(void)
7a3408
 
7a3408
     DO_TEST_COMPARE("ppc64", "host", "guest-strict", VIR_CPU_COMPARE_IDENTICAL);
7a3408
     DO_TEST_COMPARE("ppc64", "host", "guest-exact", VIR_CPU_COMPARE_INCOMPATIBLE);
7a3408
+    DO_TEST_COMPARE("ppc64", "host", "guest-legacy", VIR_CPU_COMPARE_IDENTICAL);
7a3408
+    DO_TEST_COMPARE("ppc64", "host", "guest-legacy-incompatible", VIR_CPU_COMPARE_INCOMPATIBLE);
7a3408
+    DO_TEST_COMPARE("ppc64", "host", "guest-legacy-invalid", VIR_CPU_COMPARE_ERROR);
7a3408
 
7a3408
     /* guest updates for migration
7a3408
      * automatically compares host CPU with the result */
7a3408
@@ -627,6 +637,9 @@ mymain(void)
7a3408
 
7a3408
     DO_TEST_BASELINE("ppc64", "incompatible-vendors", 0, -1);
7a3408
     DO_TEST_BASELINE("ppc64", "no-vendor", 0, 0);
7a3408
+    DO_TEST_BASELINE("ppc64", "incompatible-models", 0, -1);
7a3408
+    DO_TEST_BASELINE("ppc64", "same-model", 0, 0);
7a3408
+    DO_TEST_BASELINE("ppc64", "legacy", 0, -1);
7a3408
 
7a3408
     /* CPU features */
7a3408
     DO_TEST_HASFEATURE("x86", "host", "vmx", YES);
7a3408
@@ -664,6 +677,9 @@ mymain(void)
7a3408
 
7a3408
     DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models, NULL, 0);
7a3408
     DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, "POWER8", -1);
7a3408
+    DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy", ppc_models, NULL, 0);
7a3408
+    DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-incompatible", ppc_models, NULL, -1);
7a3408
+    DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-invalid", ppc_models, NULL, -1);
7a3408
 
7a3408
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
7a3408
 }
7a3408
diff --git a/tests/cputestdata/ppc64-baseline-incompatible-models.xml b/tests/cputestdata/ppc64-baseline-incompatible-models.xml
7a3408
new file mode 100644
7a3408
index 0000000..7e7b9a6
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-baseline-incompatible-models.xml
7a3408
@@ -0,0 +1,14 @@
7a3408
+<cpuTest>
7a3408
+<cpu>
7a3408
+  <arch>ppc64</arch>
7a3408
+  <model>POWER7</model>
7a3408
+  <vendor>IBM</vendor>
7a3408
+  <topology sockets='2' cores='4' threads='1'/>
7a3408
+</cpu>
7a3408
+<cpu>
7a3408
+  <arch>ppc64</arch>
7a3408
+  <model>POWER8</model>
7a3408
+  <vendor>IBM</vendor>
7a3408
+  <topology sockets='1' cores='1' threads='1'/>
7a3408
+</cpu>
7a3408
+</cpuTest>
7a3408
diff --git a/tests/cputestdata/ppc64-baseline-legacy.xml b/tests/cputestdata/ppc64-baseline-legacy.xml
7a3408
new file mode 100644
7a3408
index 0000000..b652497
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-baseline-legacy.xml
7a3408
@@ -0,0 +1,14 @@
7a3408
+<cpuTest>
7a3408
+<cpu>
7a3408
+  <arch>ppc64</arch>
7a3408
+  <model>POWER8</model>
7a3408
+  <vendor>IBM</vendor>
7a3408
+  <topology sockets='2' cores='4' threads='1'/>
7a3408
+</cpu>
7a3408
+<cpu>
7a3408
+  <arch>ppc64</arch>
7a3408
+  <model>power8e</model>
7a3408
+  <vendor>IBM</vendor>
7a3408
+  <topology sockets='1' cores='1' threads='1'/>
7a3408
+</cpu>
7a3408
+</cpuTest>
7a3408
diff --git a/tests/cputestdata/ppc64-baseline-same-model-result.xml b/tests/cputestdata/ppc64-baseline-same-model-result.xml
7a3408
new file mode 100644
7a3408
index 0000000..0223018
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-baseline-same-model-result.xml
7a3408
@@ -0,0 +1,3 @@
7a3408
+<cpu mode='custom' match='exact'>
7a3408
+  <model fallback='forbid'>POWER8</model>
7a3408
+</cpu>
7a3408
diff --git a/tests/cputestdata/ppc64-baseline-same-model.xml b/tests/cputestdata/ppc64-baseline-same-model.xml
7a3408
new file mode 100644
7a3408
index 0000000..dceae83
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-baseline-same-model.xml
7a3408
@@ -0,0 +1,14 @@
7a3408
+<cpuTest>
7a3408
+<cpu>
7a3408
+  <arch>ppc64</arch>
7a3408
+  <model>POWER8</model>
7a3408
+  <vendor>IBM</vendor>
7a3408
+  <topology sockets='2' cores='4' threads='1'/>
7a3408
+</cpu>
7a3408
+<cpu>
7a3408
+  <arch>ppc64</arch>
7a3408
+  <model>POWER8</model>
7a3408
+  <vendor>IBM</vendor>
7a3408
+  <topology sockets='1' cores='1' threads='1'/>
7a3408
+</cpu>
7a3408
+</cpuTest>
7a3408
diff --git a/tests/cputestdata/ppc64-guest-legacy-incompatible.xml b/tests/cputestdata/ppc64-guest-legacy-incompatible.xml
7a3408
new file mode 100644
7a3408
index 0000000..f5b8384
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-guest-legacy-incompatible.xml
7a3408
@@ -0,0 +1,3 @@
7a3408
+<cpu mode='custom' match='exact'>
7a3408
+  <model fallback='allow'>POWER8_v1.0</model>
7a3408
+</cpu>
7a3408
diff --git a/tests/cputestdata/ppc64-guest-legacy-invalid.xml b/tests/cputestdata/ppc64-guest-legacy-invalid.xml
7a3408
new file mode 100644
7a3408
index 0000000..be059c3
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-guest-legacy-invalid.xml
7a3408
@@ -0,0 +1,3 @@
7a3408
+<cpu mode='custom' match='exact'>
7a3408
+  <model fallback='allow'>POWER8E_v1.0</model>
7a3408
+</cpu>
7a3408
diff --git a/tests/cputestdata/ppc64-guest-legacy.xml b/tests/cputestdata/ppc64-guest-legacy.xml
7a3408
new file mode 100644
7a3408
index 0000000..36bae52
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-guest-legacy.xml
7a3408
@@ -0,0 +1,3 @@
7a3408
+<cpu mode='custom' match='exact'>
7a3408
+  <model fallback='allow'>POWER7_v2.3</model>
7a3408
+</cpu>
7a3408
diff --git a/tests/cputestdata/ppc64-host+guest-legacy,ppc_models-result.xml b/tests/cputestdata/ppc64-host+guest-legacy,ppc_models-result.xml
7a3408
new file mode 100644
7a3408
index 0000000..3548c0e
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-host+guest-legacy,ppc_models-result.xml
7a3408
@@ -0,0 +1,5 @@
7a3408
+<cpu mode='custom' match='exact'>
7a3408
+  <arch>ppc64</arch>
7a3408
+  <model fallback='allow'>POWER7</model>
7a3408
+  <vendor>IBM</vendor>
7a3408
+</cpu>
7a3408
diff --git a/tests/cputestdata/ppc64-host-better.xml b/tests/cputestdata/ppc64-host-better.xml
7a3408
new file mode 100644
7a3408
index 0000000..af87412
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-host-better.xml
7a3408
@@ -0,0 +1,6 @@
7a3408
+<cpu>
7a3408
+  <arch>ppc64</arch>
7a3408
+  <model>POWER8</model>
7a3408
+  <vendor>IBM</vendor>
7a3408
+  <topology sockets='1' cores='64' threads='1'/>
7a3408
+</cpu>
7a3408
diff --git a/tests/cputestdata/ppc64-host-incomp-arch.xml b/tests/cputestdata/ppc64-host-incomp-arch.xml
7a3408
new file mode 100644
7a3408
index 0000000..195f436
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-host-incomp-arch.xml
7a3408
@@ -0,0 +1,6 @@
7a3408
+<cpu>
7a3408
+  <arch>x86_64</arch>
7a3408
+  <model>POWER7</model>
7a3408
+  <vendor>IBM</vendor>
7a3408
+  <topology sockets='1' cores='64' threads='1'/>
7a3408
+</cpu>
7a3408
diff --git a/tests/cputestdata/ppc64-host-no-vendor.xml b/tests/cputestdata/ppc64-host-no-vendor.xml
7a3408
new file mode 100644
7a3408
index 0000000..de73006
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-host-no-vendor.xml
7a3408
@@ -0,0 +1,5 @@
7a3408
+<cpu>
7a3408
+  <arch>ppc64</arch>
7a3408
+  <model>POWER7</model>
7a3408
+  <topology sockets='1' cores='64' threads='1'/>
7a3408
+</cpu>
7a3408
diff --git a/tests/cputestdata/ppc64-host-worse.xml b/tests/cputestdata/ppc64-host-worse.xml
7a3408
new file mode 100644
7a3408
index 0000000..ba1806b
7a3408
--- /dev/null
7a3408
+++ b/tests/cputestdata/ppc64-host-worse.xml
7a3408
@@ -0,0 +1,6 @@
7a3408
+<cpu>
7a3408
+  <arch>ppc64</arch>
7a3408
+  <model>POWER6</model>
7a3408
+  <vendor>IBM</vendor>
7a3408
+  <topology sockets='1' cores='64' threads='1'/>
7a3408
+</cpu>
7a3408
-- 
7a3408
2.5.0
7a3408