1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

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 <jjongsma@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Jonathon Jongsma 2021-05-14 16:28:58 -05:00 committed by Michal Privoznik
parent 0ad0204ce7
commit 86ecc06c06
39 changed files with 45 additions and 5 deletions

View File

@ -0,0 +1 @@
../nodedevschemadata/DVD_GCC_4247N.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/DVD_with_media.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/ap_07_0038.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/ap_card07.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/ap_matrix.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/ap_matrix_mdev_types.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/ccw_0_0_ffff.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/computer.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/css_0_0_fffe_mdev_types.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/css_0_0_ffff.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/drm_renderD129.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/net_00_13_02_b9_f9_d3.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/net_00_15_58_2f_e9_55.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_0000_00_02_0_header_type.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_0000_00_1c_0_header_type.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_0000_02_10_7_mdev_types.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_0000_02_10_7_sriov.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_0000_02_10_7_sriov_vfs.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_1002_71c4.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_8086_0c0c_snd_hda_intel.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_8086_10c9_sriov_pf.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_8086_27c5_scsi_host.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_8086_27c5_scsi_host_0.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_8086_27c5_scsi_host_0_unique_id.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/pci_8086_4238_pcie_wireless.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/scsi_target0_0_0.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/scsi_target1_0_0.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml

View File

@ -0,0 +1 @@
../nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml

View File

@ -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;