[libvirt PATCH 1/4] test: move nodedev xml2xml output to a separate dir

Jonathon Jongsma jjongsma at redhat.com
Fri May 14 21:28:58 UTC 2021


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 at redhat.com>
---
 tests/nodedevxml2xmlout/DVD_GCC_4247N.xml     | 15 +++++++++
 tests/nodedevxml2xmlout/DVD_with_media.xml    | 18 ++++++++++
 tests/nodedevxml2xmlout/ap_07_0038.xml        |  9 +++++
 tests/nodedevxml2xmlout/ap_card07.xml         |  8 +++++
 tests/nodedevxml2xmlout/ap_matrix.xml         |  7 ++++
 .../ap_matrix_mdev_types.xml                  | 14 ++++++++
 tests/nodedevxml2xmlout/ccw_0_0_ffff.xml      | 10 ++++++
 tests/nodedevxml2xmlout/computer.xml          | 16 +++++++++
 .../css_0_0_fffe_mdev_types.xml               | 17 ++++++++++
 tests/nodedevxml2xmlout/css_0_0_ffff.xml      | 10 ++++++
 tests/nodedevxml2xmlout/drm_renderD129.xml    | 10 ++++++
 ...v_3627463d_b7f0_4fea_b468_f1da537d301b.xml |  8 +++++
 ...v_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml |  9 +++++
 .../net_00_13_02_b9_f9_d3.xml                 | 21 ++++++++++++
 .../net_00_15_58_2f_e9_55.xml                 | 21 ++++++++++++
 .../pci_0000_00_02_0_header_type.xml          | 16 +++++++++
 .../pci_0000_00_1c_0_header_type.xml          | 21 ++++++++++++
 .../pci_0000_02_10_7_mdev_types.xml           | 33 +++++++++++++++++++
 .../pci_0000_02_10_7_sriov.xml                | 24 ++++++++++++++
 .../pci_0000_02_10_7_sriov_pf_vfs_all.xml     | 29 ++++++++++++++++
 ...0_02_10_7_sriov_pf_vfs_all_header_type.xml | 31 +++++++++++++++++
 .../pci_0000_02_10_7_sriov_vfs.xml            | 27 +++++++++++++++
 ..._0000_02_10_7_sriov_zero_vfs_max_count.xml | 22 +++++++++++++
 tests/nodedevxml2xmlout/pci_1002_71c4.xml     | 14 ++++++++
 .../pci_8086_0c0c_snd_hda_intel.xml           | 17 ++++++++++
 .../pci_8086_10c9_sriov_pf.xml                | 18 ++++++++++
 .../pci_8086_27c5_scsi_host.xml               |  7 ++++
 .../pci_8086_27c5_scsi_host_0.xml             |  7 ++++
 .../pci_8086_27c5_scsi_host_0_unique_id.xml   |  8 +++++
 ...i_8086_27c5_scsi_host_scsi_device_lun0.xml | 11 +++++++
 .../pci_8086_27c5_scsi_host_scsi_host.xml     |  7 ++++
 .../pci_8086_4238_pcie_wireless.xml           | 27 +++++++++++++++
 tests/nodedevxml2xmlout/scsi_target0_0_0.xml  |  7 ++++
 tests/nodedevxml2xmlout/scsi_target1_0_0.xml  | 12 +++++++
 ...rial_3600c0ff000d7a2a5d463ff4902000000.xml | 19 +++++++++++
 ...al_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml | 14 ++++++++
 .../usb_device_1d6b_1_0000_00_1d_0.xml        | 10 ++++++
 .../usb_device_1d6b_1_0000_00_1d_0_if0.xml    | 10 ++++++
 tests/nodedevxml2xmltest.c                    | 12 ++++---
 39 files changed, 591 insertions(+), 5 deletions(-)
 create mode 100644 tests/nodedevxml2xmlout/DVD_GCC_4247N.xml
 create mode 100644 tests/nodedevxml2xmlout/DVD_with_media.xml
 create mode 100644 tests/nodedevxml2xmlout/ap_07_0038.xml
 create mode 100644 tests/nodedevxml2xmlout/ap_card07.xml
 create mode 100644 tests/nodedevxml2xmlout/ap_matrix.xml
 create mode 100644 tests/nodedevxml2xmlout/ap_matrix_mdev_types.xml
 create mode 100644 tests/nodedevxml2xmlout/ccw_0_0_ffff.xml
 create mode 100644 tests/nodedevxml2xmlout/computer.xml
 create mode 100644 tests/nodedevxml2xmlout/css_0_0_fffe_mdev_types.xml
 create mode 100644 tests/nodedevxml2xmlout/css_0_0_ffff.xml
 create mode 100644 tests/nodedevxml2xmlout/drm_renderD129.xml
 create mode 100644 tests/nodedevxml2xmlout/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml
 create mode 100644 tests/nodedevxml2xmlout/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml
 create mode 100644 tests/nodedevxml2xmlout/net_00_13_02_b9_f9_d3.xml
 create mode 100644 tests/nodedevxml2xmlout/net_00_15_58_2f_e9_55.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_0000_00_02_0_header_type.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_0000_00_1c_0_header_type.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_0000_02_10_7_mdev_types.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_vfs.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_1002_71c4.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_8086_0c0c_snd_hda_intel.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_8086_10c9_sriov_pf.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0_unique_id.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_device_lun0.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_host.xml
 create mode 100644 tests/nodedevxml2xmlout/pci_8086_4238_pcie_wireless.xml
 create mode 100644 tests/nodedevxml2xmlout/scsi_target0_0_0.xml
 create mode 100644 tests/nodedevxml2xmlout/scsi_target1_0_0.xml
 create mode 100644 tests/nodedevxml2xmlout/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml
 create mode 100644 tests/nodedevxml2xmlout/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml
 create mode 100644 tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0.xml
 create mode 100644 tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0_if0.xml

diff --git a/tests/nodedevxml2xmlout/DVD_GCC_4247N.xml b/tests/nodedevxml2xmlout/DVD_GCC_4247N.xml
new file mode 100644
index 0000000000..aed787a6c3
--- /dev/null
+++ b/tests/nodedevxml2xmlout/DVD_GCC_4247N.xml
@@ -0,0 +1,15 @@
+<device>
+  <name>DVD_GCC_4247N</name>
+  <parent>pci_8086_27df_scsi_host_scsi_device_lun0</parent>
+  <capability type='storage'>
+    <block>/dev/sr0</block>
+    <bus>scsi</bus>
+    <drive_type>cdrom</drive_type>
+    <model>RW/DVD GCC-4247N</model>
+    <vendor>HL-DT-ST</vendor>
+    <capability type='removable'>
+      <media_available>0</media_available>
+      <media_size>0</media_size>
+    </capability>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/DVD_with_media.xml b/tests/nodedevxml2xmlout/DVD_with_media.xml
new file mode 100644
index 0000000000..f169885eb1
--- /dev/null
+++ b/tests/nodedevxml2xmlout/DVD_with_media.xml
@@ -0,0 +1,18 @@
+<device>
+  <name>DVD_GCC_4247N</name>
+  <parent>pci_8086_27df_scsi_host_scsi_device_lun0</parent>
+  <capability type='storage'>
+    <block>/dev/sr0</block>
+    <bus>scsi</bus>
+    <drive_type>cdrom</drive_type>
+    <model>RW/DVD GCC-4247N</model>
+    <vendor>HL-DT-ST</vendor>
+    <capability type='removable'>
+      <media_available>1</media_available>
+      <media_size>12345678</media_size>
+      <media_label>Windows_XP_Label</media_label>
+      <logical_block_size>2048</logical_block_size>
+      <num_blocks>6028</num_blocks>
+    </capability>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/ap_07_0038.xml b/tests/nodedevxml2xmlout/ap_07_0038.xml
new file mode 100644
index 0000000000..553c68f27b
--- /dev/null
+++ b/tests/nodedevxml2xmlout/ap_07_0038.xml
@@ -0,0 +1,9 @@
+<device>
+  <name>ap_07_0038</name>
+  <path>/sys/devices/ap/card07/07.0038</path>
+  <parent>ap_card07</parent>
+  <capability type='ap_queue'>
+    <ap-adapter>0x07</ap-adapter>
+    <ap-domain>0x0038</ap-domain>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/ap_card07.xml b/tests/nodedevxml2xmlout/ap_card07.xml
new file mode 100644
index 0000000000..14a845fd62
--- /dev/null
+++ b/tests/nodedevxml2xmlout/ap_card07.xml
@@ -0,0 +1,8 @@
+<device>
+  <name>ap_card07</name>
+  <path>/sys/devices/ap/card07</path>
+  <parent>computer</parent>
+  <capability type='ap_card'>
+    <ap-adapter>0x07</ap-adapter>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/ap_matrix.xml b/tests/nodedevxml2xmlout/ap_matrix.xml
new file mode 100644
index 0000000000..30dab9cfc8
--- /dev/null
+++ b/tests/nodedevxml2xmlout/ap_matrix.xml
@@ -0,0 +1,7 @@
+<device>
+  <name>ap_matrix</name>
+  <path>/sys/devices/vfio_ap/matrix</path>
+  <parent>computer</parent>
+  <capability type='ap_matrix'>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/ap_matrix_mdev_types.xml b/tests/nodedevxml2xmlout/ap_matrix_mdev_types.xml
new file mode 100644
index 0000000000..b3802e6d8b
--- /dev/null
+++ b/tests/nodedevxml2xmlout/ap_matrix_mdev_types.xml
@@ -0,0 +1,14 @@
+<device>
+  <name>ap_matrix</name>
+  <path>/sys/devices/vfio_ap/matrix</path>
+  <parent>computer</parent>
+  <capability type='ap_matrix'>
+    <capability type='mdev_types'>
+      <type id='vfio_ap-passthrough'>
+        <name>VFIO AP Passthrough Device</name>
+        <deviceAPI>vfio-ap</deviceAPI>
+        <availableInstances>65536</availableInstances>
+      </type>
+    </capability>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/ccw_0_0_ffff.xml b/tests/nodedevxml2xmlout/ccw_0_0_ffff.xml
new file mode 100644
index 0000000000..3b8ea46e37
--- /dev/null
+++ b/tests/nodedevxml2xmlout/ccw_0_0_ffff.xml
@@ -0,0 +1,10 @@
+<device>
+  <name>ccw_0_0_ffff</name>
+  <path>/sys/devices/css0/0.0.0070/0.0.ffff</path>
+  <parent>css_0_0_0070</parent>
+  <capability type='ccw'>
+    <cssid>0x0</cssid>
+    <ssid>0x0</ssid>
+    <devno>0xffff</devno>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/computer.xml b/tests/nodedevxml2xmlout/computer.xml
new file mode 100644
index 0000000000..4e4b9188b3
--- /dev/null
+++ b/tests/nodedevxml2xmlout/computer.xml
@@ -0,0 +1,16 @@
+<device>
+  <name>computer</name>
+  <capability type='system'>
+    <hardware>
+      <vendor>LENOVO</vendor>
+      <version>ThinkPad T60p</version>
+      <serial>123123</serial>
+      <uuid>12345678-1234-1234-9596-a088b277d677</uuid>
+    </hardware>
+    <firmware>
+      <vendor>LENOVO</vendor>
+      <version>79ETE1WW (2.21 )</version>
+      <release_date>02/05/2008</release_date>
+    </firmware>
+  </capability>
+</device>
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 100644
index 0000000000..5058b6434e
--- /dev/null
+++ b/tests/nodedevxml2xmlout/css_0_0_fffe_mdev_types.xml
@@ -0,0 +1,17 @@
+<device>
+  <name>css_0_0_fffe</name>
+  <path>/sys/devices/css0/0.0.fffe</path>
+  <parent>computer</parent>
+  <capability type='css'>
+    <cssid>0x0</cssid>
+    <ssid>0x0</ssid>
+    <devno>0xfffe</devno>
+    <capability type='mdev_types'>
+      <type id='vfio_ccw-io'>
+        <name>I/O subchannel (Non-QDIO)</name>
+        <deviceAPI>vfio-ccw</deviceAPI>
+        <availableInstances>1</availableInstances>
+      </type>
+    </capability>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/css_0_0_ffff.xml b/tests/nodedevxml2xmlout/css_0_0_ffff.xml
new file mode 100644
index 0000000000..312e07fe65
--- /dev/null
+++ b/tests/nodedevxml2xmlout/css_0_0_ffff.xml
@@ -0,0 +1,10 @@
+<device>
+  <name>css_0_0_ffff</name>
+  <path>/sys/devices/css0/0.0.ffff</path>
+  <parent>computer</parent>
+  <capability type='css'>
+    <cssid>0x0</cssid>
+    <ssid>0x0</ssid>
+    <devno>0xffff</devno>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/drm_renderD129.xml b/tests/nodedevxml2xmlout/drm_renderD129.xml
new file mode 100644
index 0000000000..161481624f
--- /dev/null
+++ b/tests/nodedevxml2xmlout/drm_renderD129.xml
@@ -0,0 +1,10 @@
+<device>
+  <name>drm_renderD129</name>
+  <path>/sys/devices/pci0000:00/0000:00:02.0/drm/renderD129</path>
+  <devnode type='dev'>/dev/dri/renderD129</devnode>
+  <devnode type='link'>/dev/dri/by-path/pci-0000:00:02.0-render</devnode>
+  <parent>pci_0000_00_02_0</parent>
+  <capability type='drm'>
+    <type>render</type>
+  </capability>
+</device>
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 100644
index 0000000000..470e5917ec
--- /dev/null
+++ b/tests/nodedevxml2xmlout/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml
@@ -0,0 +1,8 @@
+<device>
+  <name>mdev_3627463d_b7f0_4fea_b468_f1da537d301b</name>
+  <parent>computer</parent>
+  <capability type='mdev'>
+    <type id='mtty-1'/>
+    <iommuGroup number='12'/>
+  </capability>
+</device>
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 100644
index 0000000000..106f759333
--- /dev/null
+++ b/tests/nodedevxml2xmlout/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml
@@ -0,0 +1,9 @@
+<device>
+  <name>mdev_ee0b88c4-f554-4dc1-809d-b2a01e8e48ad</name>
+  <path>/sys/devices/vfio_ap/matrix/mdev_ee0b88c4-f554-4dc1-809d-b2a01e8e48ad</path>
+  <parent>ap_matrix</parent>
+  <capability type='mdev'>
+    <type id='vfio_ap-passthrough'/>
+    <iommuGroup number='0'/>
+  </capability>
+</device>
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 100644
index 0000000000..88252e6a4e
--- /dev/null
+++ b/tests/nodedevxml2xmlout/net_00_13_02_b9_f9_d3.xml
@@ -0,0 +1,21 @@
+<device>
+  <name>net_00_13_02_b9_f9_d3</name>
+  <parent>pci_8086_4227</parent>
+  <capability type='net'>
+    <interface>eth0</interface>
+    <address>00:13:02:b9:f9:d3</address>
+    <feature name='rx'/>
+    <feature name='tx'/>
+    <feature name='sg'/>
+    <feature name='tso'/>
+    <feature name='gso'/>
+    <feature name='gro'/>
+    <feature name='rxvlan'/>
+    <feature name='txvlan'/>
+    <feature name='rxhash'/>
+    <feature name='rdma'/>
+    <feature name='txudptnl'/>
+    <feature name='switchdev'/>
+    <capability type='80211'/>
+  </capability>
+</device>
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 100644
index 0000000000..f77dfcc3e0
--- /dev/null
+++ b/tests/nodedevxml2xmlout/net_00_15_58_2f_e9_55.xml
@@ -0,0 +1,21 @@
+<device>
+  <name>net_00_15_58_2f_e9_55</name>
+  <parent>pci_8086_109a</parent>
+  <capability type='net'>
+    <interface>eth1</interface>
+    <address>00:15:58:2f:e9:55</address>
+    <feature name='rx'/>
+    <feature name='tx'/>
+    <feature name='sg'/>
+    <feature name='tso'/>
+    <feature name='gso'/>
+    <feature name='gro'/>
+    <feature name='rxvlan'/>
+    <feature name='txvlan'/>
+    <feature name='rxhash'/>
+    <feature name='rdma'/>
+    <feature name='txudptnl'/>
+    <feature name='switchdev'/>
+    <capability type='80203'/>
+  </capability>
+</device>
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 100644
index 0000000000..387fce7051
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_0000_00_02_0_header_type.xml
@@ -0,0 +1,16 @@
+<device>
+  <name>pci_0000_00_02_0</name>
+  <parent>computer</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>0</bus>
+    <slot>2</slot>
+    <function>0</function>
+    <product id='0x0416'>4th Gen Core Processor Integrated Graphics Controller</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <iommuGroup number='1'>
+      <address domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </iommuGroup>
+  </capability>
+</device>
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 100644
index 0000000000..b07d14faa5
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_0000_00_1c_0_header_type.xml
@@ -0,0 +1,21 @@
+<device>
+  <name>pci_0000_00_1c_0</name>
+  <parent>computer</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>0</bus>
+    <slot>28</slot>
+    <function>0</function>
+    <product id='0x8c10'>8 Series/C220 Series Chipset Family PCI Express Root Port #1</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='pci-bridge'/>
+    <iommuGroup number='8'>
+      <address domain='0x0000' bus='0x00' slot='0x1c' function='0x0'/>
+    </iommuGroup>
+    <pci-express>
+      <link validity='cap' port='1' speed='5' width='1'/>
+      <link validity='sta' speed='2.5' width='1'/>
+    </pci-express>
+  </capability>
+</device>
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 100644
index 0000000000..8e71e3f897
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_mdev_types.xml
@@ -0,0 +1,33 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='mdev_types'>
+      <type id='foo1'>
+        <name>bar1</name>
+        <deviceAPI>vfio-pci</deviceAPI>
+        <availableInstances>1</availableInstances>
+      </type>
+      <type id='foo2'>
+        <name>bar2</name>
+        <deviceAPI>vfio-pci</deviceAPI>
+        <availableInstances>2</availableInstances>
+      </type>
+    </capability>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
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 100644
index 0000000000..6fa2b406a5
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov.xml
@@ -0,0 +1,24 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='phys_function'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
+    </capability>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
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 100644
index 0000000000..9e8dace020
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all.xml
@@ -0,0 +1,29 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='phys_function'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
+    </capability>
+    <capability type='virt_functions' maxCount='7'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x2'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x3'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x4'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x5'/>
+    </capability>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
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 100644
index 0000000000..c30c0d0d2b
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml
@@ -0,0 +1,31 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='phys_function'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
+    </capability>
+    <capability type='virt_functions' maxCount='7'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x2'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x3'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x4'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x5'/>
+    </capability>
+    <capability type='pci-bridge'/>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
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 100644
index 0000000000..096055e2ae
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_vfs.xml
@@ -0,0 +1,27 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='virt_functions'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x2'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x3'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x4'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x5'/>
+    </capability>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
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 100644
index 0000000000..8259cd059b
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml
@@ -0,0 +1,22 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='virt_functions' maxCount='3'/>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/pci_1002_71c4.xml b/tests/nodedevxml2xmlout/pci_1002_71c4.xml
new file mode 100644
index 0000000000..2039e2201f
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_1002_71c4.xml
@@ -0,0 +1,14 @@
+<device>
+  <name>pci_1002_71c4</name>
+  <parent>pci_8086_27a1</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>1</bus>
+    <slot>0</slot>
+    <function>0</function>
+    <product id='0x71c4'>M56GL [Mobility FireGL V5200]</product>
+    <vendor id='0x1002'>ATI Technologies Inc</vendor>
+    <numa node='1'/>
+  </capability>
+</device>
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 100644
index 0000000000..3ffe53b8c9
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_8086_0c0c_snd_hda_intel.xml
@@ -0,0 +1,17 @@
+<device>
+  <name>pci_0000_00_03_0</name>
+  <parent>computer</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>0</bus>
+    <slot>3</slot>
+    <function>0</function>
+    <product id='0x0c0c'>Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <iommuGroup number='2'>
+      <address domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </iommuGroup>
+    <pci-express/>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/pci_8086_10c9_sriov_pf.xml b/tests/nodedevxml2xmlout/pci_8086_10c9_sriov_pf.xml
new file mode 100644
index 0000000000..6bd1292095
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_8086_10c9_sriov_pf.xml
@@ -0,0 +1,18 @@
+<device>
+  <name>pci_0000_02_00_0</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>0</slot>
+    <function>0</function>
+    <product id='0x10c9'>82576 Gigabit Network Connection</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <iommuGroup number='12'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
+    </iommuGroup>
+    <numa node='0'/>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host.xml b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host.xml
new file mode 100644
index 0000000000..3b377a383f
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host.xml
@@ -0,0 +1,7 @@
+<device>
+  <name>pci_8086_27c5_scsi_host</name>
+  <parent>pci_8086_27c5</parent>
+  <capability type='scsi_host'>
+    <host>0</host>
+  </capability>
+</device>
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 100644
index 0000000000..a160167824
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0.xml
@@ -0,0 +1,7 @@
+<device>
+  <name>pci_8086_27c5_scsi_host_0</name>
+  <parent>pci_8086_27c5</parent>
+  <capability type='scsi_host'>
+    <host>1</host>
+  </capability>
+</device>
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 100644
index 0000000000..5428f59d17
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_0_unique_id.xml
@@ -0,0 +1,8 @@
+<device>
+  <name>pci_8086_27c5_scsi_host_0</name>
+  <parent>pci_8086_27c5</parent>
+  <capability type='scsi_host'>
+    <host>1</host>
+    <unique_id>2</unique_id>
+  </capability>
+</device>
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 100644
index 0000000000..5c2dff7b01
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_device_lun0.xml
@@ -0,0 +1,11 @@
+<device>
+  <name>pci_8086_27c5_scsi_host_scsi_device_lun0</name>
+  <parent>pci_8086_27c5_scsi_host</parent>
+  <capability type='scsi'>
+    <host>0</host>
+    <bus>0</bus>
+    <target>0</target>
+    <lun>0</lun>
+    <type>disk</type>
+  </capability>
+</device>
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 100644
index 0000000000..8ffb0a5bb8
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_8086_27c5_scsi_host_scsi_host.xml
@@ -0,0 +1,7 @@
+<device>
+  <name>pci_8086_27c5_scsi_host_scsi_host</name>
+  <parent>pci_8086_27c5_scsi_host</parent>
+  <capability type='scsi_host'>
+    <host>0</host>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/pci_8086_4238_pcie_wireless.xml b/tests/nodedevxml2xmlout/pci_8086_4238_pcie_wireless.xml
new file mode 100644
index 0000000000..59f5ec8622
--- /dev/null
+++ b/tests/nodedevxml2xmlout/pci_8086_4238_pcie_wireless.xml
@@ -0,0 +1,27 @@
+<device>
+  <name>pci_0000_03_00_0</name>
+  <parent>pci_0000_00_1c_1</parent>
+  <capability type='pci'>
+    <class>0xffffff</class>
+    <domain>0</domain>
+    <bus>3</bus>
+    <slot>0</slot>
+    <function>0</function>
+    <product id='0x4238'>Centrino Ultimate-N 6300</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <iommuGroup number='8'>
+      <address domain='0x0000' bus='0x00' slot='0x1c' function='0x0'/>
+      <address domain='0x0000' bus='0x00' slot='0x1c' function='0x1'/>
+      <address domain='0x0000' bus='0x00' slot='0x1c' function='0x3'/>
+      <address domain='0x0000' bus='0x00' slot='0x1c' function='0x4'/>
+      <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
+      <address domain='0x0000' bus='0x0d' slot='0x00' function='0x0'/>
+      <address domain='0x0000' bus='0x0d' slot='0x00' function='0x1'/>
+      <address domain='0x0000' bus='0x0d' slot='0x00' function='0x3'/>
+    </iommuGroup>
+    <pci-express>
+      <link validity='cap' port='1' speed='2.5' width='1'/>
+      <link validity='sta' speed='2.5' width='1'/>
+    </pci-express>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/scsi_target0_0_0.xml b/tests/nodedevxml2xmlout/scsi_target0_0_0.xml
new file mode 100644
index 0000000000..b83c96dfda
--- /dev/null
+++ b/tests/nodedevxml2xmlout/scsi_target0_0_0.xml
@@ -0,0 +1,7 @@
+<device>
+  <name>scsi_target0_0_0</name>
+  <parent>scsi_host0</parent>
+  <capability type='scsi_target'>
+    <target>target0:0:0</target>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/scsi_target1_0_0.xml b/tests/nodedevxml2xmlout/scsi_target1_0_0.xml
new file mode 100644
index 0000000000..b783c54fea
--- /dev/null
+++ b/tests/nodedevxml2xmlout/scsi_target1_0_0.xml
@@ -0,0 +1,12 @@
+<device>
+  <name>scsi_target1_0_0</name>
+  <path>/sys/devices/css0/0.0.0000/0.0.0000/host1/rport-1:0-0/target1:0:0</path>
+  <parent>scsi_host0</parent>
+  <capability type='scsi_target'>
+    <target>target1:0:0</target>
+    <capability type='fc_remote_port'>
+      <rport>rport-1:0-0</rport>
+      <wwpn>0x9d73bc45f0e21a86</wwpn>
+    </capability>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml b/tests/nodedevxml2xmlout/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml
new file mode 100644
index 0000000000..5bdbb8ac95
--- /dev/null
+++ b/tests/nodedevxml2xmlout/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml
@@ -0,0 +1,19 @@
+<device>
+  <name>storage_serial_3600c0ff000d7a2a5d463ff4902000000</name>
+  <devnode type='dev'>/dev/sdb</devnode>
+  <devnode type='link'>/dev/disk/by-id/usb-SanDisk_Ultra_Fit_4C530001051009112405-0:0</devnode>
+  <devnode type='link'>/dev/disk/by-path/pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0</devnode>
+  <devnode type='link'>/dev/disk/by-uuid/661A1A460111DA18</devnode>
+  <parent>pci_10df_fe00_scsi_host_scsi_device_lun8</parent>
+  <capability type='storage'>
+    <block>/dev/sdj</block>
+    <bus>pci</bus>
+    <drive_type>disk</drive_type>
+    <model>MSA2012fc</model>
+    <vendor>HP</vendor>
+    <serial>3600c0ff000d7a2a5d463ff4902000000</serial>
+    <size>15626928128</size>
+    <logical_block_size>512</logical_block_size>
+    <num_blocks>30521344</num_blocks>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmlout/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml b/tests/nodedevxml2xmlout/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml
new file mode 100644
index 0000000000..68dbf0be96
--- /dev/null
+++ b/tests/nodedevxml2xmlout/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml
@@ -0,0 +1,14 @@
+<device>
+  <name>storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE</name>
+  <parent>pci_8086_27c5_scsi_host_scsi_device_lun0</parent>
+  <capability type='storage'>
+    <block>/dev/sda</block>
+    <bus>scsi</bus>
+    <drive_type>disk</drive_type>
+    <model>HTS721010G9SA00</model>
+    <vendor>ATA</vendor>
+    <size>100030242816</size>
+    <logical_block_size>512</logical_block_size>
+    <num_blocks>195371568</num_blocks>
+  </capability>
+</device>
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 100644
index 0000000000..29533e769b
--- /dev/null
+++ b/tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0.xml
@@ -0,0 +1,10 @@
+<device>
+  <name>usb_device_1d6b_1_0000_00_1d_0</name>
+  <parent>pci_8086_27c8</parent>
+  <capability type='usb_device'>
+    <bus>2</bus>
+    <device>1</device>
+    <product id='0x0001'>1.1 root hub</product>
+    <vendor id='0x1d6b'>Linux Foundation</vendor>
+  </capability>
+</device>
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 100644
index 0000000000..9de35c7e8c
--- /dev/null
+++ b/tests/nodedevxml2xmlout/usb_device_1d6b_1_0000_00_1d_0_if0.xml
@@ -0,0 +1,10 @@
+<device>
+  <name>usb_device_1d6b_1_0000_00_1d_0_if0</name>
+  <parent>usb_device_1d6b_1_0000_00_1d_0</parent>
+  <capability type='usb'>
+    <number>0</number>
+    <class>9</class>
+    <subclass>0</subclass>
+    <protocol>0</protocol>
+  </capability>
+</device>
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
index 4ebd578ccc..04d238bbca 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;
+    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;
-- 
2.31.1




More information about the libvir-list mailing list