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

[libvirt PATCH 2/3] tests: Ensure that cpu comparison fails in the presence of unknown xml elements



Signed-off-by: Tim Wiederhake <twiederh redhat com>
---
 tests/cputest.c                              | 2 ++
 tests/cputestdata/x86_64-bogus-attribute.xml | 2 ++
 tests/cputestdata/x86_64-bogus-element.xml   | 3 +++
 3 files changed, 7 insertions(+)
 create mode 100644 tests/cputestdata/x86_64-bogus-attribute.xml
 create mode 100644 tests/cputestdata/x86_64-bogus-element.xml

diff --git a/tests/cputest.c b/tests/cputest.c
index 195a215b84..4bfd20dcaf 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -1114,6 +1114,8 @@ mymain(void)
     /* guest to host comparison */
     DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "bogus-model", VIR_CPU_COMPARE_ERROR);
     DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "bogus-feature", VIR_CPU_COMPARE_ERROR);
+    DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "bogus-element", VIR_CPU_COMPARE_ERROR);
+    DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "bogus-attribute", VIR_CPU_COMPARE_ERROR);
     DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "min", VIR_CPU_COMPARE_SUPERSET);
     DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "pentium3", VIR_CPU_COMPARE_SUPERSET);
     DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "exact", VIR_CPU_COMPARE_SUPERSET);
diff --git a/tests/cputestdata/x86_64-bogus-attribute.xml b/tests/cputestdata/x86_64-bogus-attribute.xml
new file mode 100644
index 0000000000..073ee793e6
--- /dev/null
+++ b/tests/cputestdata/x86_64-bogus-attribute.xml
@@ -0,0 +1,2 @@
+<cpu nonExistantAttribute="">
+</cpu>
diff --git a/tests/cputestdata/x86_64-bogus-element.xml b/tests/cputestdata/x86_64-bogus-element.xml
new file mode 100644
index 0000000000..79f98bad18
--- /dev/null
+++ b/tests/cputestdata/x86_64-bogus-element.xml
@@ -0,0 +1,3 @@
+<cpu>
+  <nonExistantElement/>
+</cpu>
-- 
2.26.2


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