From: Jonathon Jongsma Date: Fri, 14 May 2021 21:28:58 +0000 (-0500) Subject: test: move nodedev xml2xml output to a separate dir X-Git-Tag: v7.4.0-rc1~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86ecc06c068fadb3c681a502b82cbcb8a334f194;p=thirdparty%2Flibvirt.git test: move nodedev xml2xml output to a separate dir Currently, we're loading and parsing the xml from the input file, and then formatting it and then comparing it directly back to the input file. This works for now, but is severely limiting as it relies on the input file being fully-specified and in the exact order as the output xml format. If optional elements are ommitted in the input XML, the output xml may include default values for the ommitted elements and thus the output will not match the input. In order to allow more flexibility in testing, save the expected output to a seprate 'out' directory similar to what most of the other xml2xml tests are already doing. Signed-off-by: Jonathon Jongsma Signed-off-by: Michal Privoznik Reviewed-by: Michal Privoznik --- diff --git a/tests/nodedevxml2xmlout/DVD_GCC_4247N.xml b/tests/nodedevxml2xmlout/DVD_GCC_4247N.xml new file mode 120000 index 0000000000..f959c4e83b --- /dev/null +++ b/tests/nodedevxml2xmlout/DVD_GCC_4247N.xml @@ -0,0 +1 @@ +../nodedevschemadata/DVD_GCC_4247N.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/DVD_with_media.xml b/tests/nodedevxml2xmlout/DVD_with_media.xml new file mode 120000 index 0000000000..214267ff33 --- /dev/null +++ b/tests/nodedevxml2xmlout/DVD_with_media.xml @@ -0,0 +1 @@ +../nodedevschemadata/DVD_with_media.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/ap_07_0038.xml b/tests/nodedevxml2xmlout/ap_07_0038.xml new file mode 120000 index 0000000000..663134fec4 --- /dev/null +++ b/tests/nodedevxml2xmlout/ap_07_0038.xml @@ -0,0 +1 @@ +../nodedevschemadata/ap_07_0038.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/ap_card07.xml b/tests/nodedevxml2xmlout/ap_card07.xml new file mode 120000 index 0000000000..820471aedb --- /dev/null +++ b/tests/nodedevxml2xmlout/ap_card07.xml @@ -0,0 +1 @@ +../nodedevschemadata/ap_card07.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/ap_matrix.xml b/tests/nodedevxml2xmlout/ap_matrix.xml new file mode 120000 index 0000000000..0b4cf9c2b5 --- /dev/null +++ b/tests/nodedevxml2xmlout/ap_matrix.xml @@ -0,0 +1 @@ +../nodedevschemadata/ap_matrix.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/ap_matrix_mdev_types.xml b/tests/nodedevxml2xmlout/ap_matrix_mdev_types.xml new file mode 120000 index 0000000000..30ce3ac6db --- /dev/null +++ b/tests/nodedevxml2xmlout/ap_matrix_mdev_types.xml @@ -0,0 +1 @@ +../nodedevschemadata/ap_matrix_mdev_types.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/ccw_0_0_ffff.xml b/tests/nodedevxml2xmlout/ccw_0_0_ffff.xml new file mode 120000 index 0000000000..f75c2279f3 --- /dev/null +++ b/tests/nodedevxml2xmlout/ccw_0_0_ffff.xml @@ -0,0 +1 @@ +../nodedevschemadata/ccw_0_0_ffff.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/computer.xml b/tests/nodedevxml2xmlout/computer.xml new file mode 120000 index 0000000000..fe419c2315 --- /dev/null +++ b/tests/nodedevxml2xmlout/computer.xml @@ -0,0 +1 @@ +../nodedevschemadata/computer.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/css_0_0_fffe_mdev_types.xml b/tests/nodedevxml2xmlout/css_0_0_fffe_mdev_types.xml new file mode 120000 index 0000000000..071bf1025a --- /dev/null +++ b/tests/nodedevxml2xmlout/css_0_0_fffe_mdev_types.xml @@ -0,0 +1 @@ +../nodedevschemadata/css_0_0_fffe_mdev_types.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/css_0_0_ffff.xml b/tests/nodedevxml2xmlout/css_0_0_ffff.xml new file mode 120000 index 0000000000..1af778cd1d --- /dev/null +++ b/tests/nodedevxml2xmlout/css_0_0_ffff.xml @@ -0,0 +1 @@ +../nodedevschemadata/css_0_0_ffff.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/drm_renderD129.xml b/tests/nodedevxml2xmlout/drm_renderD129.xml new file mode 120000 index 0000000000..3af2b820f2 --- /dev/null +++ b/tests/nodedevxml2xmlout/drm_renderD129.xml @@ -0,0 +1 @@ +../nodedevschemadata/drm_renderD129.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml b/tests/nodedevxml2xmlout/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml new file mode 120000 index 0000000000..cbc883e48c --- /dev/null +++ b/tests/nodedevxml2xmlout/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml @@ -0,0 +1 @@ +../nodedevschemadata/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml b/tests/nodedevxml2xmlout/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml new file mode 120000 index 0000000000..238bfb4dfd --- /dev/null +++ b/tests/nodedevxml2xmlout/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml @@ -0,0 +1 @@ +../nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/net_00_13_02_b9_f9_d3.xml b/tests/nodedevxml2xmlout/net_00_13_02_b9_f9_d3.xml new file mode 120000 index 0000000000..8133db2f21 --- /dev/null +++ b/tests/nodedevxml2xmlout/net_00_13_02_b9_f9_d3.xml @@ -0,0 +1 @@ +../nodedevschemadata/net_00_13_02_b9_f9_d3.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/net_00_15_58_2f_e9_55.xml b/tests/nodedevxml2xmlout/net_00_15_58_2f_e9_55.xml new file mode 120000 index 0000000000..e85ee9ee43 --- /dev/null +++ b/tests/nodedevxml2xmlout/net_00_15_58_2f_e9_55.xml @@ -0,0 +1 @@ +../nodedevschemadata/net_00_15_58_2f_e9_55.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_0000_00_02_0_header_type.xml b/tests/nodedevxml2xmlout/pci_0000_00_02_0_header_type.xml new file mode 120000 index 0000000000..60b35a69c2 --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_0000_00_02_0_header_type.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_0000_00_02_0_header_type.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_0000_00_1c_0_header_type.xml b/tests/nodedevxml2xmlout/pci_0000_00_1c_0_header_type.xml new file mode 120000 index 0000000000..b3c0df97bf --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_0000_00_1c_0_header_type.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_0000_00_1c_0_header_type.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_0000_02_10_7_mdev_types.xml b/tests/nodedevxml2xmlout/pci_0000_02_10_7_mdev_types.xml new file mode 120000 index 0000000000..a166e2b1de --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_mdev_types.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_0000_02_10_7_mdev_types.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov.xml b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov.xml new file mode 120000 index 0000000000..4bc09ae1c6 --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_0000_02_10_7_sriov.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all.xml b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all.xml new file mode 120000 index 0000000000..6e996bec99 --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml new file mode 120000 index 0000000000..e7b9731b44 --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_vfs.xml b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_vfs.xml new file mode 120000 index 0000000000..8966776329 --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_vfs.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_0000_02_10_7_sriov_vfs.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml new file mode 120000 index 0000000000..1b64588e7d --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_1002_71c4.xml b/tests/nodedevxml2xmlout/pci_1002_71c4.xml new file mode 120000 index 0000000000..2743a7e4c5 --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_1002_71c4.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_1002_71c4.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_8086_0c0c_snd_hda_intel.xml b/tests/nodedevxml2xmlout/pci_8086_0c0c_snd_hda_intel.xml new file mode 120000 index 0000000000..9d07f02726 --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_8086_0c0c_snd_hda_intel.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_8086_0c0c_snd_hda_intel.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_8086_10c9_sriov_pf.xml b/tests/nodedevxml2xmlout/pci_8086_10c9_sriov_pf.xml new file mode 120000 index 0000000000..a618bca11f --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_8086_10c9_sriov_pf.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_8086_10c9_sriov_pf.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host.xml b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host.xml new file mode 120000 index 0000000000..a51cf9115e --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_8086_27c5_scsi_host.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0.xml b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0.xml new file mode 120000 index 0000000000..d6ec89349d --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_8086_27c5_scsi_host_0.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0_unique_id.xml b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0_unique_id.xml new file mode 120000 index 0000000000..62e0af28c7 --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0_unique_id.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_8086_27c5_scsi_host_0_unique_id.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_device_lun0.xml b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_device_lun0.xml new file mode 120000 index 0000000000..aac3aeb02f --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_device_lun0.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_host.xml b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_host.xml new file mode 120000 index 0000000000..49b1074a5c --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_host.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/pci_8086_4238_pcie_wireless.xml b/tests/nodedevxml2xmlout/pci_8086_4238_pcie_wireless.xml new file mode 120000 index 0000000000..756f71b4bd --- /dev/null +++ b/tests/nodedevxml2xmlout/pci_8086_4238_pcie_wireless.xml @@ -0,0 +1 @@ +../nodedevschemadata/pci_8086_4238_pcie_wireless.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/scsi_target0_0_0.xml b/tests/nodedevxml2xmlout/scsi_target0_0_0.xml new file mode 120000 index 0000000000..39f7b4d904 --- /dev/null +++ b/tests/nodedevxml2xmlout/scsi_target0_0_0.xml @@ -0,0 +1 @@ +../nodedevschemadata/scsi_target0_0_0.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/scsi_target1_0_0.xml b/tests/nodedevxml2xmlout/scsi_target1_0_0.xml new file mode 120000 index 0000000000..8d496370d3 --- /dev/null +++ b/tests/nodedevxml2xmlout/scsi_target1_0_0.xml @@ -0,0 +1 @@ +../nodedevschemadata/scsi_target1_0_0.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml b/tests/nodedevxml2xmlout/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml new file mode 120000 index 0000000000..d0857bac60 --- /dev/null +++ b/tests/nodedevxml2xmlout/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml @@ -0,0 +1 @@ +../nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml b/tests/nodedevxml2xmlout/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml new file mode 120000 index 0000000000..eb4bf232fe --- /dev/null +++ b/tests/nodedevxml2xmlout/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml @@ -0,0 +1 @@ +../nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0.xml b/tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0.xml new file mode 120000 index 0000000000..b735e1d756 --- /dev/null +++ b/tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0.xml @@ -0,0 +1 @@ +../nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0_if0.xml b/tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0_if0.xml new file mode 120000 index 0000000000..fca950f842 --- /dev/null +++ b/tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0_if0.xml @@ -0,0 +1 @@ +../nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml \ No newline at end of file diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index 4ebd578ccc..60a8fcd486 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -14,7 +14,7 @@ #define VIR_FROM_THIS VIR_FROM_NONE static int -testCompareXMLToXMLFiles(const char *xml) +testCompareXMLToXMLFiles(const char *xml, const char *outfile) { char *xmlData = NULL; char *actual = NULL; @@ -52,10 +52,8 @@ testCompareXMLToXMLFiles(const char *xml) if (!(actual = virNodeDeviceDefFormat(dev))) goto fail; - if (STRNEQ(xmlData, actual)) { - virTestDifferenceFull(stderr, xmlData, xml, actual, NULL); + if (virTestCompareToFile(actual, outfile) < 0) goto fail; - } ret = 0; @@ -71,11 +69,15 @@ testCompareXMLToXMLHelper(const void *data) { int result = -1; char *xml = NULL; + g_autofree char *outfile = NULL; xml = g_strdup_printf("%s/nodedevschemadata/%s.xml", abs_srcdir, (const char *)data); - result = testCompareXMLToXMLFiles(xml); + outfile = g_strdup_printf("%s/nodedevxml2xmlout/%s.xml", abs_srcdir, + (const char *)data); + + result = testCompareXMLToXMLFiles(xml, outfile); VIR_FREE(xml); return result;