From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
This patch is to add test cases for PPC CPU driver.
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
tests/cputest.c | 9 +++++++++
tests/cputestdata/ppc64-baseline-1-result.xml | 3 +++
.../ppc64-baseline-incompatible-vendors.xml | 14 ++++++++++++++
.../cputestdata/ppc64-baseline-no-vendor-result.xml | 3 +++
tests/cputestdata/ppc64-baseline-no-vendor.xml | 7 +++++++
tests/cputestdata/ppc64-exact.xml | 3 +++
tests/cputestdata/ppc64-guest-nofallback.xml | 4 ++++
tests/cputestdata/ppc64-guest.xml | 4 ++++
.../ppc64-host+guest,ppc_models-result.xml | 5 +++++
...est-nofallback,ppc_models,POWER7_v2.1-result.xml | 5 +++++
tests/cputestdata/ppc64-host.xml | 6 ++++++
tests/cputestdata/ppc64-strict.xml | 3 +++
.../qemuxml2argv-pseries-cpu-exact.args | 7 +++++++
.../qemuxml2argv-pseries-cpu-exact.xml | 21 +++++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
15 files changed, 95 insertions(+)
create mode 100644 tests/cputestdata/ppc64-baseline-1-result.xml
create mode 100644 tests/cputestdata/ppc64-baseline-incompatible-vendors.xml
create mode 100644 tests/cputestdata/ppc64-baseline-no-vendor-result.xml
create mode 100644 tests/cputestdata/ppc64-baseline-no-vendor.xml
create mode 100644 tests/cputestdata/ppc64-exact.xml
create mode 100644 tests/cputestdata/ppc64-guest-nofallback.xml
create mode 100644 tests/cputestdata/ppc64-guest.xml
create mode 100644 tests/cputestdata/ppc64-host+guest,ppc_models-result.xml
create mode 100644
tests/cputestdata/ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml
create mode 100644 tests/cputestdata/ppc64-host.xml
create mode 100644 tests/cputestdata/ppc64-strict.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.xml
diff --git a/tests/cputest.c b/tests/cputest.c
index 959cb9f..408a510 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -493,6 +493,7 @@ cpuTestRun(const char *name, const struct data *data)
static const char *model486[] = { "486" };
static const char *nomodel[] = { "nomodel" };
static const char *models[] = { "qemu64", "core2duo",
"Nehalem" };
+static const char *ppc_models[] = { "POWER7", "POWER7_v2.1",
"POWER8_v1.0"};
static int
mymain(void)
@@ -584,6 +585,9 @@ mymain(void)
DO_TEST_COMPARE("x86", "host-worse", "nehalem-force",
VIR_CPU_COMPARE_IDENTICAL);
DO_TEST_COMPARE("x86", "host-SandyBridge",
"exact-force-Haswell", VIR_CPU_COMPARE_IDENTICAL);
+ DO_TEST_COMPARE("ppc64", "host", "strict",
VIR_CPU_COMPARE_IDENTICAL);
+ DO_TEST_COMPARE("ppc64", "host", "exact",
VIR_CPU_COMPARE_INCOMPATIBLE);
+
/* guest updates for migration
* automatically compares host CPU with the result */
DO_TEST_UPDATE("x86", "host", "min",
VIR_CPU_COMPARE_IDENTICAL);
@@ -601,6 +605,8 @@ mymain(void)
DO_TEST_BASELINE("x86", "2", 0, 0);
DO_TEST_BASELINE("x86", "3",
VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
+ DO_TEST_BASELINE("ppc64", "incompatible-vendors", 0, -1);
+ DO_TEST_BASELINE("ppc64", "no-vendor", 0, 0);
/* CPU features */
DO_TEST_HASFEATURE("x86", "host", "vmx", YES);
DO_TEST_HASFEATURE("x86", "host", "lm", YES);
@@ -627,6 +633,9 @@ mymain(void)
DO_TEST_GUESTDATA("x86", "host",
"host+host-model-nofallback",
models, "Penryn", -1);
+ DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models,
NULL, 0);
+ DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback",
ppc_models, "POWER7_v2.1", -1);
+
VIR_FREE(map);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/cputestdata/ppc64-baseline-1-result.xml
b/tests/cputestdata/ppc64-baseline-1-result.xml
new file mode 100644
index 0000000..cbdd9bc
--- /dev/null
+++ b/tests/cputestdata/ppc64-baseline-1-result.xml
@@ -0,0 +1,3 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='allow'>POWER7+_v2.1</model>
+</cpu>
diff --git a/tests/cputestdata/ppc64-baseline-incompatible-vendors.xml
b/tests/cputestdata/ppc64-baseline-incompatible-vendors.xml
new file mode 100644
index 0000000..97d3c9c
--- /dev/null
+++ b/tests/cputestdata/ppc64-baseline-incompatible-vendors.xml
@@ -0,0 +1,14 @@
+<cpuTest>
+<cpu>
+ <arch>ppc64</arch>
+ <model>POWER7+_v2.1</model>
+ <vendor>Intel</vendor>
+ <topology sockets='2' cores='4' threads='1'/>
+</cpu>
+<cpu>
+ <arch>ppc64</arch>
+ <model>POWER8_v1.0</model>
+ <vendor>Intel</vendor>
+ <topology sockets='1' cores='1' threads='1'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/ppc64-baseline-no-vendor-result.xml
b/tests/cputestdata/ppc64-baseline-no-vendor-result.xml
new file mode 100644
index 0000000..36bae52
--- /dev/null
+++ b/tests/cputestdata/ppc64-baseline-no-vendor-result.xml
@@ -0,0 +1,3 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='allow'>POWER7_v2.3</model>
+</cpu>
diff --git a/tests/cputestdata/ppc64-baseline-no-vendor.xml
b/tests/cputestdata/ppc64-baseline-no-vendor.xml
new file mode 100644
index 0000000..5e69a62
--- /dev/null
+++ b/tests/cputestdata/ppc64-baseline-no-vendor.xml
@@ -0,0 +1,7 @@
+<cpuTest>
+<cpu>
+ <arch>ppc64</arch>
+ <model>POWER7_v2.3</model>
+ <topology sockets='2' cores='4' threads='1'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/ppc64-exact.xml b/tests/cputestdata/ppc64-exact.xml
new file mode 100644
index 0000000..c84f16a
--- /dev/null
+++ b/tests/cputestdata/ppc64-exact.xml
@@ -0,0 +1,3 @@
+<cpu match='exact'>
+ <model>POWER8_v1.0</model>
+</cpu>
diff --git a/tests/cputestdata/ppc64-guest-nofallback.xml
b/tests/cputestdata/ppc64-guest-nofallback.xml
new file mode 100644
index 0000000..42026b4
--- /dev/null
+++ b/tests/cputestdata/ppc64-guest-nofallback.xml
@@ -0,0 +1,4 @@
+<cpu match='exact'>
+ <model fallback='forbid'>POWER7_v2.1</model>
+ <topology sockets='2' cores='4' threads='1'/>
+</cpu>
diff --git a/tests/cputestdata/ppc64-guest.xml b/tests/cputestdata/ppc64-guest.xml
new file mode 100644
index 0000000..ac81ec0
--- /dev/null
+++ b/tests/cputestdata/ppc64-guest.xml
@@ -0,0 +1,4 @@
+<cpu match='exact'>
+ <model>POWER8_v1.0</model>
+ <topology sockets='2' cores='4' threads='1'/>
+</cpu>
diff --git a/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml
b/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml
new file mode 100644
index 0000000..0cb0830
--- /dev/null
+++ b/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml
@@ -0,0 +1,5 @@
+<cpu mode='custom' match='exact'>
+ <arch>ppc64</arch>
+ <model fallback='allow'>POWER8_v1.0</model>
+ <vendor>IBM</vendor>
+</cpu>
diff --git
a/tests/cputestdata/ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml
b/tests/cputestdata/ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml
new file mode 100644
index 0000000..7e58361
--- /dev/null
+++ b/tests/cputestdata/ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml
@@ -0,0 +1,5 @@
+<cpu mode='custom' match='exact'>
+ <arch>ppc64</arch>
+ <model fallback='forbid'>POWER7_v2.1</model>
+ <vendor>IBM</vendor>
+</cpu>
diff --git a/tests/cputestdata/ppc64-host.xml b/tests/cputestdata/ppc64-host.xml
new file mode 100644
index 0000000..39cb741
--- /dev/null
+++ b/tests/cputestdata/ppc64-host.xml
@@ -0,0 +1,6 @@
+<cpu>
+ <arch>ppc64</arch>
+ <model>POWER7_v2.3</model>
+ <vendor>IBM</vendor>
+ <topology sockets='1' cores='64' threads='1'/>
+</cpu>
diff --git a/tests/cputestdata/ppc64-strict.xml b/tests/cputestdata/ppc64-strict.xml
new file mode 100644
index 0000000..e91c6e7
--- /dev/null
+++ b/tests/cputestdata/ppc64-strict.xml
@@ -0,0 +1,3 @@
+<cpu match='exact'>
+ <model>POWER7_v2.3</model>
+</cpu>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args
b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args
new file mode 100644
index 0000000..1e09680
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
+/usr/bin/qemu-system-ppc64 -S -M pseries -cpu POWER7_v2.3 -m 512 -smp 1 -nographic \
+-nodefconfig -nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb \
+-chardev pty,id=charserial0 \
+-device spapr-vty,chardev=charserial0,reg=0x30000000
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.xml
b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.xml
new file mode 100644
index 0000000..b54dae2
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.xml
@@ -0,0 +1,21 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <memory unit='KiB'>524288</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc64' machine='pseries'>hvm</type>
+ </os>
+ <cpu match='exact'>
+ <model>POWER7_v2.3</model>
+ <vendor>IBM</vendor>
+ </cpu>
+ <clock offset='utc'/>
+ <devices>
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <console type='pty'>
+ <address type="spapr-vio"/>
+ </console>
+ <memballoon model="none"/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 99406b6..e90c914 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -946,6 +946,7 @@ mymain(void)
DO_TEST_ERROR("pseries-vio-address-clash", QEMU_CAPS_DRIVE,
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM);
+ DO_TEST_FAILURE("pseries-cpu-exact", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
QEMU_CAPS_NODEFCONFIG);
DO_TEST("disk-ide-drive-split",
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_IDE_CD);
--
1.8.1.4