From 89b60f0cefe533a5fda021fae303e7662c141d02 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Mon, 16 Oct 2017 17:45:48 +0800
Subject: [PATCH 11/11] tests: add baseline test cases for arm CPU

add baseline test cases for aarch64

Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
 tests/cputest.c                               |  7 +++++
 .../aarch64-baseline-incompatible-vendors.xml | 26 +++++++++++++++++++
 ...-baseline-no-compatible-feature-result.xml |  4 +++
 ...aarch64-baseline-no-compatible-feature.xml | 19 ++++++++++++++
 .../aarch64-baseline-no-feature-result.xml    |  4 +++
 .../aarch64-baseline-no-feature.xml           |  7 +++++
 .../cputestdata/aarch64-baseline-no-model.xml | 13 ++++++++++
 .../aarch64-baseline-no-vendor-result.xml     | 10 +++++++
 .../aarch64-baseline-no-vendor.xml            | 13 ++++++++++
 ...baseline-one-compatible-feature-result.xml |  5 ++++
 ...arch64-baseline-one-compatible-feature.xml | 20 ++++++++++++++
 .../aarch64-baseline-one-feature-result.xml   |  5 ++++
 .../aarch64-baseline-one-feature.xml          |  8 ++++++
 13 files changed, 141 insertions(+)
 create mode 100644 tests/cputestdata/aarch64-baseline-incompatible-vendors.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-no-compatible-feature-result.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-no-compatible-feature.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-no-feature-result.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-no-feature.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-no-model.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-no-vendor-result.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-no-vendor.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-one-compatible-feature-result.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-one-compatible-feature.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-one-feature-result.xml
 create mode 100644 tests/cputestdata/aarch64-baseline-one-feature.xml

diff --git a/tests/cputest.c b/tests/cputest.c
index e4b4531..3657fa4 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -1194,6 +1194,13 @@ mymain(void)
     DO_TEST_BASELINE(VIR_ARCH_PPC64, "same-model", 0, 0);
     DO_TEST_BASELINE(VIR_ARCH_PPC64, "legacy", 0, -1);
 
+    DO_TEST_BASELINE(VIR_ARCH_AARCH64, "incompatible-vendors", 0, -1);
+    DO_TEST_BASELINE(VIR_ARCH_AARCH64, "no-vendor", 0, 0);
+    DO_TEST_BASELINE(VIR_ARCH_AARCH64, "no-feature", 0, 0);
+    DO_TEST_BASELINE(VIR_ARCH_AARCH64, "one-feature", 0, 0);
+    DO_TEST_BASELINE(VIR_ARCH_AARCH64, "no-compatible-feature", 0, 0);
+    DO_TEST_BASELINE(VIR_ARCH_AARCH64, "one-compatible-feature", 0, 0);
+
     /* CPU features */
     DO_TEST_HASFEATURE(VIR_ARCH_X86_64, "host", "vmx", YES);
     DO_TEST_HASFEATURE(VIR_ARCH_X86_64, "host", "lm", YES);
diff --git a/tests/cputestdata/aarch64-baseline-incompatible-vendors.xml b/tests/cputestdata/aarch64-baseline-incompatible-vendors.xml
new file mode 100644
index 0000000..f2c71a1
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-incompatible-vendors.xml
@@ -0,0 +1,26 @@
+<cpuTest>
+<cpu>
+  <arch>aarch64</arch>
+  <model>cortex-a57</model>
+  <vendor>ARM</vendor>
+  <feature name='fp'/>
+  <feature name='asimd'/>
+  <feature name='aes'/>
+  <feature name='pmull'/>
+  <feature name='sha1'/>
+  <feature name='sha2'/>
+  <feature name='crc32'/>
+</cpu>
+<cpu>
+  <arch>aarch64</arch>
+  <model>cortex-a72</model>
+  <vendor>Hisilicon</vendor>
+  <feature name='fp'/>
+  <feature name='asimd'/>
+  <feature name='aes'/>
+  <feature name='pmull'/>
+  <feature name='sha1'/>
+  <feature name='sha2'/>
+  <feature name='crc32'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-no-compatible-feature-result.xml b/tests/cputestdata/aarch64-baseline-no-compatible-feature-result.xml
new file mode 100644
index 0000000..6db66aa
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-compatible-feature-result.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+  <model fallback='forbid'>cortex-a57</model>
+  <vendor>ARM</vendor>
+</cpu>
diff --git a/tests/cputestdata/aarch64-baseline-no-compatible-feature.xml b/tests/cputestdata/aarch64-baseline-no-compatible-feature.xml
new file mode 100644
index 0000000..5fd3228
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-compatible-feature.xml
@@ -0,0 +1,19 @@
+<cpuTest>
+<cpu>
+  <arch>aarch64</arch>
+  <model>cortex-a57</model>
+  <vendor>ARM</vendor>
+  <feature name='fp'/>
+  <feature name='asimd'/>
+  <feature name='pmull'/>
+  <feature name='sha2'/>
+  <feature name='crc32'/>
+</cpu>
+<cpu>
+  <arch>aarch64</arch>
+  <model>cortex-a57</model>
+  <vendor>ARM</vendor>
+  <feature name='aes'/>
+  <feature name='sha1'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-no-feature-result.xml b/tests/cputestdata/aarch64-baseline-no-feature-result.xml
new file mode 100644
index 0000000..6db66aa
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-feature-result.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+  <model fallback='forbid'>cortex-a57</model>
+  <vendor>ARM</vendor>
+</cpu>
diff --git a/tests/cputestdata/aarch64-baseline-no-feature.xml b/tests/cputestdata/aarch64-baseline-no-feature.xml
new file mode 100644
index 0000000..0d6af96
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-feature.xml
@@ -0,0 +1,7 @@
+<cpuTest>
+<cpu>
+  <arch>aarch64</arch>
+  <model>cortex-a57</model>
+  <vendor>ARM</vendor>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-no-model.xml b/tests/cputestdata/aarch64-baseline-no-model.xml
new file mode 100644
index 0000000..6033e4c
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-model.xml
@@ -0,0 +1,13 @@
+<cpuTest>
+<cpu>
+  <arch>aarch64</arch>
+  <vendor>ARM</vendor>
+  <feature name='fp'/>
+  <feature name='asimd'/>
+  <feature name='aes'/>
+  <feature name='pmull'/>
+  <feature name='sha1'/>
+  <feature name='sha2'/>
+  <feature name='crc32'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-no-vendor-result.xml b/tests/cputestdata/aarch64-baseline-no-vendor-result.xml
new file mode 100644
index 0000000..c1d74c2
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-vendor-result.xml
@@ -0,0 +1,10 @@
+<cpu mode='custom' match='exact'>
+  <model fallback='forbid'>cortex-a57</model>
+  <feature policy='require' name='fp'/>
+  <feature policy='require' name='asimd'/>
+  <feature policy='require' name='aes'/>
+  <feature policy='require' name='pmull'/>
+  <feature policy='require' name='sha1'/>
+  <feature policy='require' name='sha2'/>
+  <feature policy='require' name='crc32'/>
+</cpu>
diff --git a/tests/cputestdata/aarch64-baseline-no-vendor.xml b/tests/cputestdata/aarch64-baseline-no-vendor.xml
new file mode 100644
index 0000000..8aacb3e
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-no-vendor.xml
@@ -0,0 +1,13 @@
+<cpuTest>
+<cpu>
+  <arch>aarch64</arch>
+  <model>cortex-a57</model>
+  <feature name='fp'/>
+  <feature name='asimd'/>
+  <feature name='aes'/>
+  <feature name='pmull'/>
+  <feature name='sha1'/>
+  <feature name='sha2'/>
+  <feature name='crc32'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-one-compatible-feature-result.xml b/tests/cputestdata/aarch64-baseline-one-compatible-feature-result.xml
new file mode 100644
index 0000000..84c559d
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-one-compatible-feature-result.xml
@@ -0,0 +1,5 @@
+<cpu mode='custom' match='exact'>
+  <model fallback='forbid'>cortex-a57</model>
+  <vendor>ARM</vendor>
+  <feature policy='require' name='sha1'/>
+</cpu>
diff --git a/tests/cputestdata/aarch64-baseline-one-compatible-feature.xml b/tests/cputestdata/aarch64-baseline-one-compatible-feature.xml
new file mode 100644
index 0000000..c85059b
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-one-compatible-feature.xml
@@ -0,0 +1,20 @@
+<cpuTest>
+<cpu>
+  <arch>aarch64</arch>
+  <model>cortex-a57</model>
+  <vendor>ARM</vendor>
+  <feature name='fp'/>
+  <feature name='asimd'/>
+  <feature name='aes'/>
+  <feature name='pmull'/>
+  <feature name='sha1'/>
+  <feature name='sha2'/>
+  <feature name='crc32'/>
+</cpu>
+<cpu>
+  <arch>aarch64</arch>
+  <model>cortex-a57</model>
+  <vendor>ARM</vendor>
+  <feature name='sha1'/>
+</cpu>
+</cpuTest>
diff --git a/tests/cputestdata/aarch64-baseline-one-feature-result.xml b/tests/cputestdata/aarch64-baseline-one-feature-result.xml
new file mode 100644
index 0000000..0fcea51
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-one-feature-result.xml
@@ -0,0 +1,5 @@
+<cpu mode='custom' match='exact'>
+  <model fallback='forbid'>cortex-a57</model>
+  <vendor>ARM</vendor>
+  <feature policy='require' name='fp'/>
+</cpu>
diff --git a/tests/cputestdata/aarch64-baseline-one-feature.xml b/tests/cputestdata/aarch64-baseline-one-feature.xml
new file mode 100644
index 0000000..e0ae15f
--- /dev/null
+++ b/tests/cputestdata/aarch64-baseline-one-feature.xml
@@ -0,0 +1,8 @@
+<cpuTest>
+<cpu>
+  <arch>aarch64</arch>
+  <model>cortex-a57</model>
+  <vendor>ARM</vendor>
+  <feature name='fp'/>
+</cpu>
+</cpuTest>
-- 
2.23.0

