10 #include "node_device_conf.h"
11 #include "testutilsqemu.h"
12 #include "virstring.h"
14 #define VIR_FROM_THIS VIR_FROM_NONE
17 testCompareXMLToXMLFiles(const char *xml
)
22 virNodeDeviceDefPtr dev
= NULL
;
23 virNodeDevCapsDefPtr caps
;
25 if (virTestLoadFile(xml
, &xmlData
) < 0)
28 if (!(dev
= virNodeDeviceDefParseString(xmlData
, EXISTING_DEVICE
, NULL
)))
31 /* Calculate some things that are not read in */
32 for (caps
= dev
->caps
; caps
; caps
= caps
->next
) {
33 virNodeDevCapDataPtr data
= &caps
->data
;
35 if (caps
->data
.type
== VIR_NODE_DEV_CAP_STORAGE
) {
36 if (data
->storage
.flags
& VIR_NODE_DEV_CAP_STORAGE_REMOVABLE
) {
37 if (data
->storage
.flags
&
38 VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE
) {
39 data
->storage
.logical_block_size
= 2048;
40 data
->storage
.num_blocks
=
41 data
->storage
.removable_media_size
/
42 data
->storage
.logical_block_size
;
45 data
->storage
.logical_block_size
= 512;
46 data
->storage
.num_blocks
= data
->storage
.size
/
47 data
->storage
.logical_block_size
;
52 if (!(actual
= virNodeDeviceDefFormat(dev
)))
55 if (STRNEQ(xmlData
, actual
)) {
56 virTestDifferenceFull(stderr
, xmlData
, xml
, actual
, NULL
);
65 virNodeDeviceDefFree(dev
);
70 testCompareXMLToXMLHelper(const void *data
)
75 if (virAsprintf(&xml
, "%s/nodedevschemadata/%s.xml",
76 abs_srcdir
, (const char*)data
) < 0)
79 result
= testCompareXMLToXMLFiles(xml
);
91 #define DO_TEST(name) \
92 if (virTestRun("Node device XML-2-XML " name, \
93 testCompareXMLToXMLHelper, (name)) < 0) \
97 DO_TEST("DVD_GCC_4247N");
98 DO_TEST("DVD_with_media");
99 DO_TEST("net_00_13_02_b9_f9_d3");
100 DO_TEST("net_00_15_58_2f_e9_55");
101 DO_TEST("pci_1002_71c4");
102 DO_TEST("pci_8086_10c9_sriov_pf");
103 DO_TEST("pci_8086_27c5_scsi_host_0");
104 DO_TEST("pci_8086_27c5_scsi_host_0_unique_id");
105 DO_TEST("pci_8086_27c5_scsi_host_scsi_device_lun0");
106 DO_TEST("pci_8086_27c5_scsi_host_scsi_host");
107 DO_TEST("pci_8086_27c5_scsi_host");
108 DO_TEST("storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE");
109 DO_TEST("storage_serial_3600c0ff000d7a2a5d463ff4902000000");
110 DO_TEST("usb_device_1d6b_1_0000_00_1d_0_if0");
111 DO_TEST("usb_device_1d6b_1_0000_00_1d_0");
112 DO_TEST("pci_8086_4238_pcie_wireless");
113 DO_TEST("pci_8086_0c0c_snd_hda_intel");
114 DO_TEST("pci_0000_00_02_0_header_type");
115 DO_TEST("pci_0000_00_1c_0_header_type");
116 DO_TEST("scsi_target0_0_0");
117 DO_TEST("scsi_target1_0_0");
118 DO_TEST("pci_0000_02_10_7_sriov");
119 DO_TEST("pci_0000_02_10_7_sriov_vfs");
120 DO_TEST("pci_0000_02_10_7_sriov_zero_vfs_max_count");
121 DO_TEST("pci_0000_02_10_7_sriov_pf_vfs_all");
122 DO_TEST("pci_0000_02_10_7_sriov_pf_vfs_all_header_type");
123 DO_TEST("drm_renderD129");
124 DO_TEST("pci_0000_02_10_7_mdev_types");
125 DO_TEST("mdev_3627463d_b7f0_4fea_b468_f1da537d301b");
126 DO_TEST("ccw_0_0_ffff");
128 return ret
== 0 ? EXIT_SUCCESS
: EXIT_FAILURE
;
131 VIR_TEST_MAIN(mymain
)