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. Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- .../qemuxml2argvdata/pseries-features-ccf.xml | 15 +++- .../pseries-features-cfpc.xml | 15 +++- .../pseries-features-hpt-pagesize.xml | 17 ++++- .../qemuxml2argvdata/pseries-features-htm.xml | 15 +++- .../qemuxml2argvdata/pseries-features-ibs.xml | 15 +++- .../pseries-features-nested-hv.xml | 15 +++- .../pseries-features-sbbc.xml | 15 +++- tests/qemuxml2argvtest.c | 69 ++----------------- 8 files changed, 107 insertions(+), 69 deletions(-) mode change 120000 => 100644 tests/qemuxml2argvdata/pseries-features-ccf.xml mode change 120000 => 100644 tests/qemuxml2argvdata/pseries-features-cfpc.xml mode change 120000 => 100644 tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml mode change 120000 => 100644 tests/qemuxml2argvdata/pseries-features-htm.xml mode change 120000 => 100644 tests/qemuxml2argvdata/pseries-features-ibs.xml mode change 120000 => 100644 tests/qemuxml2argvdata/pseries-features-nested-hv.xml mode change 120000 => 100644 tests/qemuxml2argvdata/pseries-features-sbbc.xml diff --git a/tests/qemuxml2argvdata/pseries-features-ccf.xml b/tests/qemuxml2argvdata/pseries-features-ccf.xml deleted file mode 120000 index e7b69bba78..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-ccf.xml +++ /dev/null @@ -1 +0,0 @@ -pseries-features.xml \ No newline at end of file diff --git a/tests/qemuxml2argvdata/pseries-features-ccf.xml b/tests/qemuxml2argvdata/pseries-features-ccf.xml new file mode 100644 index 0000000000..037d9feaab --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-ccf.xml @@ -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> diff --git a/tests/qemuxml2argvdata/pseries-features-cfpc.xml b/tests/qemuxml2argvdata/pseries-features-cfpc.xml deleted file mode 120000 index e7b69bba78..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-cfpc.xml +++ /dev/null @@ -1 +0,0 @@ -pseries-features.xml \ No newline at end of file diff --git a/tests/qemuxml2argvdata/pseries-features-cfpc.xml b/tests/qemuxml2argvdata/pseries-features-cfpc.xml new file mode 100644 index 0000000000..9229e87aab --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-cfpc.xml @@ -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> diff --git a/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml b/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml deleted file mode 120000 index e7b69bba78..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml +++ /dev/null @@ -1 +0,0 @@ -pseries-features.xml \ No newline at end of file diff --git a/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml b/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml new file mode 100644 index 0000000000..ba919f6b0d --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml @@ -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> diff --git a/tests/qemuxml2argvdata/pseries-features-htm.xml b/tests/qemuxml2argvdata/pseries-features-htm.xml deleted file mode 120000 index e7b69bba78..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-htm.xml +++ /dev/null @@ -1 +0,0 @@ -pseries-features.xml \ No newline at end of file diff --git a/tests/qemuxml2argvdata/pseries-features-htm.xml b/tests/qemuxml2argvdata/pseries-features-htm.xml new file mode 100644 index 0000000000..59ac294161 --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-htm.xml @@ -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> diff --git a/tests/qemuxml2argvdata/pseries-features-ibs.xml b/tests/qemuxml2argvdata/pseries-features-ibs.xml deleted file mode 120000 index e7b69bba78..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-ibs.xml +++ /dev/null @@ -1 +0,0 @@ -pseries-features.xml \ No newline at end of file diff --git a/tests/qemuxml2argvdata/pseries-features-ibs.xml b/tests/qemuxml2argvdata/pseries-features-ibs.xml new file mode 100644 index 0000000000..c3317b47ba --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-ibs.xml @@ -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> diff --git a/tests/qemuxml2argvdata/pseries-features-nested-hv.xml b/tests/qemuxml2argvdata/pseries-features-nested-hv.xml deleted file mode 120000 index e7b69bba78..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-nested-hv.xml +++ /dev/null @@ -1 +0,0 @@ -pseries-features.xml \ No newline at end of file diff --git a/tests/qemuxml2argvdata/pseries-features-nested-hv.xml b/tests/qemuxml2argvdata/pseries-features-nested-hv.xml new file mode 100644 index 0000000000..8d74ab41ab --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-nested-hv.xml @@ -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> diff --git a/tests/qemuxml2argvdata/pseries-features-sbbc.xml b/tests/qemuxml2argvdata/pseries-features-sbbc.xml deleted file mode 120000 index e7b69bba78..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-sbbc.xml +++ /dev/null @@ -1 +0,0 @@ -pseries-features.xml \ No newline at end of file diff --git a/tests/qemuxml2argvdata/pseries-features-sbbc.xml b/tests/qemuxml2argvdata/pseries-features-sbbc.xml new file mode 100644 index 0000000000..e7f8d46176 --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-sbbc.xml @@ -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> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 67b9ffb3e7..f11edda699 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2170,74 +2170,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"); -- 2.37.3