]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: refactor pseries features parse failure tests
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Thu, 15 Sep 2022 16:22:08 +0000 (13:22 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Thu, 13 Oct 2022 19:28:01 +0000 (16:28 -0300)
The qemuxml2argvtest pseries-feature parse failure tests uses a symlink
to the pseries-features.xml test domain and control which feature it is
supposed to fail by excluding it from the capabilities list. The
advantage of this approach is that the same XML can be used in multiple
tests.

One downside is that any new pseries capability must be declared in all
existent tests, otherwise all other tests can break if this new
capability happens to be validated early in qemu_validate.c. Any new
parse_error test must declare all other existent capabilities.

Another downside is the fact that we're testing fairly improbable
scenarios: all pseries capabilities being tested here were introduced by
the same QEMU version, 4.2.0, at least as far as libvirt is aware of.
This means that it's no possible to have a scenario where, for example,
ccf-assist is not present but cfpc is. And last, but not the least, it's
getting in the way of our effort to convert all pseries tests to not use
explicit capabilities.

Changing all these tests to use DO_TEST_PARSE_ERROR_NOCAPS() will allow
us to test exactly what we want to test, which is the parse error given
for each feature if the binary does not have support for it. The XML
being used for each test can be simplified to just declare a single
feature. In the end we'll end up with more XML lines, but less
complexity inside qemuxml2argvtest.c.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
tests/qemuxml2argvdata/pseries-features-ccf.xml [changed from symlink to file mode: 0644]
tests/qemuxml2argvdata/pseries-features-cfpc.xml [changed from symlink to file mode: 0644]
tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml [changed from symlink to file mode: 0644]
tests/qemuxml2argvdata/pseries-features-htm.xml [changed from symlink to file mode: 0644]
tests/qemuxml2argvdata/pseries-features-ibs.xml [changed from symlink to file mode: 0644]
tests/qemuxml2argvdata/pseries-features-nested-hv.xml [changed from symlink to file mode: 0644]
tests/qemuxml2argvdata/pseries-features-sbbc.xml [changed from symlink to file mode: 0644]
tests/qemuxml2argvtest.c

deleted file mode 120000 (symlink)
index e7b69bba785f7b42126dea645afac2ed6ff66716..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-pseries-features.xml
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..037d9feaabceedf80a77ecc549cd7b7b66e39b2c
--- /dev/null
@@ -0,0 +1,14 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <features>
+    <ccf-assist state='on'/>
+  </features>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+  </devices>
+</domain>
deleted file mode 120000 (symlink)
index e7b69bba785f7b42126dea645afac2ed6ff66716..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-pseries-features.xml
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9229e87aab48dd6e46efe273989a8cac48f7fcc3
--- /dev/null
@@ -0,0 +1,14 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <features>
+    <cfpc value='fixed'/>
+  </features>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+  </devices>
+</domain>
deleted file mode 120000 (symlink)
index e7b69bba785f7b42126dea645afac2ed6ff66716..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-pseries-features.xml
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ba919f6b0df4874fc9921a533639ae45d3009e2c
--- /dev/null
@@ -0,0 +1,16 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <features>
+    <hpt resizing='required'>
+      <maxpagesize unit='GiB'>1</maxpagesize>
+    </hpt>
+  </features>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+  </devices>
+</domain>
deleted file mode 120000 (symlink)
index e7b69bba785f7b42126dea645afac2ed6ff66716..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-pseries-features.xml
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..59ac294161a1d65f5cc119756cef2eafb2af43bc
--- /dev/null
@@ -0,0 +1,14 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <features>
+    <htm state='on'/>
+  </features>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+  </devices>
+</domain>
deleted file mode 120000 (symlink)
index e7b69bba785f7b42126dea645afac2ed6ff66716..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-pseries-features.xml
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c3317b47bab4211fdf0ca69721a78da2ea905b59
--- /dev/null
@@ -0,0 +1,14 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <features>
+    <ibs value='fixed-ccd'/>
+  </features>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+  </devices>
+</domain>
deleted file mode 120000 (symlink)
index e7b69bba785f7b42126dea645afac2ed6ff66716..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-pseries-features.xml
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8d74ab41abc49fef67d41d81f074054fdc23661b
--- /dev/null
@@ -0,0 +1,14 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <features>
+    <nested-hv state='on'/>
+  </features>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+  </devices>
+</domain>
deleted file mode 120000 (symlink)
index e7b69bba785f7b42126dea645afac2ed6ff66716..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-pseries-features.xml
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e7f8d4617663639af399bff8117d8deb1b0d1a3e
--- /dev/null
@@ -0,0 +1,14 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <features>
+    <sbbc value='workaround'/>
+  </features>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+  </devices>
+</domain>
index dc990adfa119ca4daf08f146e488799c7860e1f7..de69cd426ab36030a60d7988d5fee470ff5c8718 100644 (file)
@@ -2132,74 +2132,19 @@ mymain(void)
     DO_TEST_CAPS_LATEST_PPC64("pseries-features");
 
     /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE */
-    DO_TEST_PARSE_ERROR("pseries-features-hpt-pagesize",
-                        QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_IBS);
-
+    DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-hpt-pagesize");
     /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_HTM */
-    DO_TEST_PARSE_ERROR("pseries-features-htm",
-                        QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_IBS);
-
+    DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-htm");
     /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV */
-    DO_TEST_PARSE_ERROR("pseries-features-nested-hv",
-                        QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_IBS);
-
+    DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-nested-hv");
     /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST */
-    DO_TEST_PARSE_ERROR("pseries-features-ccf",
-                        QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_IBS);
-
+    DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-ccf");
     /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CFPC */
-    DO_TEST_PARSE_ERROR("pseries-features-cfpc",
-                        QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_IBS);
-
+    DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-cfpc");
     /* parse error: no QEMU_CAPS_MACHINE_PSERIES_SBBC */
-    DO_TEST_PARSE_ERROR("pseries-features-sbbc",
-                        QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_IBS);
-
+    DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-sbbc");
     /* parse error: no QEMU_CAPS_MACHINE_PSERIES_IBS */
-    DO_TEST_PARSE_ERROR("pseries-features-ibs",
-                        QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC,
-                        QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC);
+    DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-ibs");
 
     DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-invalid-machine");