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

[libvirt PATCH 9/9] tests: Add tests for unknown elements and attributes in cpu defintion



Signed-off-by: Tim Wiederhake <twiederh redhat com>
---
 tests/cputest.c                              | 4 ++++
 tests/cputestdata/x86_64-bogus-attribute.xml | 2 ++
 tests/cputestdata/x86_64-bogus-element.xml   | 3 +++
 3 files changed, 9 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 30a125c3da..2d00040497 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -1106,6 +1106,10 @@ mymain(void)
         } \
     } while (0)
 
+    /* invalid xml */
+    DO_TEST_COMPARE_FLAGS(VIR_ARCH_X86_64, "host", "bogus-element", VIR_CPU_COMPARE_ERROR, VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
+    DO_TEST_COMPARE_FLAGS(VIR_ARCH_X86_64, "host", "bogus-attribute", VIR_CPU_COMPARE_ERROR, VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
+
     /* host to host comparison */
     DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host", VIR_CPU_COMPARE_IDENTICAL);
     DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host-better", VIR_CPU_COMPARE_INCOMPATIBLE);
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]