]> xenbits.xensource.com Git - libvirt.git/commitdiff
test: move nodedev xml2xml output to a separate dir
authorJonathon Jongsma <jjongsma@redhat.com>
Fri, 14 May 2021 21:28:58 +0000 (16:28 -0500)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 20 May 2021 08:59:45 +0000 (10:59 +0200)
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>
39 files changed:
tests/nodedevxml2xmlout/DVD_GCC_4247N.xml [new symlink]
tests/nodedevxml2xmlout/DVD_with_media.xml [new symlink]
tests/nodedevxml2xmlout/ap_07_0038.xml [new symlink]
tests/nodedevxml2xmlout/ap_card07.xml [new symlink]
tests/nodedevxml2xmlout/ap_matrix.xml [new symlink]
tests/nodedevxml2xmlout/ap_matrix_mdev_types.xml [new symlink]
tests/nodedevxml2xmlout/ccw_0_0_ffff.xml [new symlink]
tests/nodedevxml2xmlout/computer.xml [new symlink]
tests/nodedevxml2xmlout/css_0_0_fffe_mdev_types.xml [new symlink]
tests/nodedevxml2xmlout/css_0_0_ffff.xml [new symlink]
tests/nodedevxml2xmlout/drm_renderD129.xml [new symlink]
tests/nodedevxml2xmlout/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml [new symlink]
tests/nodedevxml2xmlout/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml [new symlink]
tests/nodedevxml2xmlout/net_00_13_02_b9_f9_d3.xml [new symlink]
tests/nodedevxml2xmlout/net_00_15_58_2f_e9_55.xml [new symlink]
tests/nodedevxml2xmlout/pci_0000_00_02_0_header_type.xml [new symlink]
tests/nodedevxml2xmlout/pci_0000_00_1c_0_header_type.xml [new symlink]
tests/nodedevxml2xmlout/pci_0000_02_10_7_mdev_types.xml [new symlink]
tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov.xml [new symlink]
tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all.xml [new symlink]
tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml [new symlink]
tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_vfs.xml [new symlink]
tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml [new symlink]
tests/nodedevxml2xmlout/pci_1002_71c4.xml [new symlink]
tests/nodedevxml2xmlout/pci_8086_0c0c_snd_hda_intel.xml [new symlink]
tests/nodedevxml2xmlout/pci_8086_10c9_sriov_pf.xml [new symlink]
tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host.xml [new symlink]
tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0.xml [new symlink]
tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0_unique_id.xml [new symlink]
tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_device_lun0.xml [new symlink]
tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_host.xml [new symlink]
tests/nodedevxml2xmlout/pci_8086_4238_pcie_wireless.xml [new symlink]
tests/nodedevxml2xmlout/scsi_target0_0_0.xml [new symlink]
tests/nodedevxml2xmlout/scsi_target1_0_0.xml [new symlink]
tests/nodedevxml2xmlout/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml [new symlink]
tests/nodedevxml2xmlout/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml [new symlink]
tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0.xml [new symlink]
tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0_if0.xml [new symlink]
tests/nodedevxml2xmltest.c

diff --git a/tests/nodedevxml2xmlout/DVD_GCC_4247N.xml b/tests/nodedevxml2xmlout/DVD_GCC_4247N.xml
new file mode 120000 (symlink)
index 0000000..f959c4e
--- /dev/null
@@ -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 (symlink)
index 0000000..214267f
--- /dev/null
@@ -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 (symlink)
index 0000000..663134f
--- /dev/null
@@ -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 (symlink)
index 0000000..820471a
--- /dev/null
@@ -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 (symlink)
index 0000000..0b4cf9c
--- /dev/null
@@ -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 (symlink)
index 0000000..30ce3ac
--- /dev/null
@@ -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 (symlink)
index 0000000..f75c227
--- /dev/null
@@ -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 (symlink)
index 0000000..fe419c2
--- /dev/null
@@ -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 (symlink)
index 0000000..071bf10
--- /dev/null
@@ -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 (symlink)
index 0000000..1af778c
--- /dev/null
@@ -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 (symlink)
index 0000000..3af2b82
--- /dev/null
@@ -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 (symlink)
index 0000000..cbc883e
--- /dev/null
@@ -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 (symlink)
index 0000000..238bfb4
--- /dev/null
@@ -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 (symlink)
index 0000000..8133db2
--- /dev/null
@@ -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 (symlink)
index 0000000..e85ee9e
--- /dev/null
@@ -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 (symlink)
index 0000000..60b35a6
--- /dev/null
@@ -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 (symlink)
index 0000000..b3c0df9
--- /dev/null
@@ -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 (symlink)
index 0000000..a166e2b
--- /dev/null
@@ -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 (symlink)
index 0000000..4bc09ae
--- /dev/null
@@ -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 (symlink)
index 0000000..6e996be
--- /dev/null
@@ -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 (symlink)
index 0000000..e7b9731
--- /dev/null
@@ -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 (symlink)
index 0000000..8966776
--- /dev/null
@@ -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 (symlink)
index 0000000..1b64588
--- /dev/null
@@ -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 (symlink)
index 0000000..2743a7e
--- /dev/null
@@ -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 (symlink)
index 0000000..9d07f02
--- /dev/null
@@ -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 (symlink)
index 0000000..a618bca
--- /dev/null
@@ -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 (symlink)
index 0000000..a51cf91
--- /dev/null
@@ -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 (symlink)
index 0000000..d6ec893
--- /dev/null
@@ -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 (symlink)
index 0000000..62e0af2
--- /dev/null
@@ -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 (symlink)
index 0000000..aac3aeb
--- /dev/null
@@ -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 (symlink)
index 0000000..49b1074
--- /dev/null
@@ -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 (symlink)
index 0000000..756f71b
--- /dev/null
@@ -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 (symlink)
index 0000000..39f7b4d
--- /dev/null
@@ -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 (symlink)
index 0000000..8d49637
--- /dev/null
@@ -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 (symlink)
index 0000000..d0857ba
--- /dev/null
@@ -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 (symlink)
index 0000000..eb4bf23
--- /dev/null
@@ -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 (symlink)
index 0000000..b735e1d
--- /dev/null
@@ -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 (symlink)
index 0000000..fca950f
--- /dev/null
@@ -0,0 +1 @@
+../nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml
\ No newline at end of file
index 4ebd578ccc05e7989511d71e69fe3f22b0afd6e6..60a8fcd4863e10f66f31f8027fe85dfda07ff7a1 100644 (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;