mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
tests: Test the previously mishandled PCI VPD characters
Modify the test data to validate '<>' and other characters. Unfortunately the test suite doesn't have a proper end-to-end test, thus we just add a XML->XML variant and also add data to the binary parser. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
edaa1112ff
commit
9eda33161f
@ -15,7 +15,7 @@
|
|||||||
<change_level>B1</change_level>
|
<change_level>B1</change_level>
|
||||||
<manufacture_id>foobar</manufacture_id>
|
<manufacture_id>foobar</manufacture_id>
|
||||||
<part_number>MBF2H332A-AEEOT</part_number>
|
<part_number>MBF2H332A-AEEOT</part_number>
|
||||||
<serial_number>MT2113X00000</serial_number>
|
<serial_number>MT2113X00000><</serial_number>
|
||||||
<vendor_field index='0'>PCIeGen4 x8</vendor_field>
|
<vendor_field index='0'>PCIeGen4 x8</vendor_field>
|
||||||
<vendor_field index='2'>MBF2H332A-AEEOT</vendor_field>
|
<vendor_field index='2'>MBF2H332A-AEEOT</vendor_field>
|
||||||
<vendor_field index='3'>3c53d07eec484d8aab34dabd24fe575aa</vendor_field>
|
<vendor_field index='3'>3c53d07eec484d8aab34dabd24fe575aa</vendor_field>
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<asset_tag>fooasset</asset_tag>
|
<asset_tag>fooasset</asset_tag>
|
||||||
<vendor_field index='0'>vendorfield0</vendor_field>
|
<vendor_field index='0'>vendorfield0</vendor_field>
|
||||||
<vendor_field index='2'>vendorfield2</vendor_field>
|
<vendor_field index='2'>vendorfield2</vendor_field>
|
||||||
<vendor_field index='A'>vendorfieldA</vendor_field>
|
<vendor_field index='A'>!@#$./><</vendor_field>
|
||||||
<system_field index='B'>systemfieldB</system_field>
|
<system_field index='B'>systemfieldB</system_field>
|
||||||
<system_field index='0'>systemfield0</system_field>
|
<system_field index='0'>systemfield0</system_field>
|
||||||
</fields>
|
</fields>
|
||||||
|
@ -966,9 +966,9 @@ init_env(void)
|
|||||||
't', 'e', 's', 't', 'n', 'a', 'm', 'e',
|
't', 'e', 's', 't', 'n', 'a', 'm', 'e',
|
||||||
PCI_VPD_LARGE_RESOURCE_FLAG | PCI_VPD_READ_ONLY_LARGE_RESOURCE_FLAG, 0x16, 0x00,
|
PCI_VPD_LARGE_RESOURCE_FLAG | PCI_VPD_READ_ONLY_LARGE_RESOURCE_FLAG, 0x16, 0x00,
|
||||||
'P', 'N', 0x02, '4', '2',
|
'P', 'N', 0x02, '4', '2',
|
||||||
'E', 'C', 0x04, '4', '2', '4', '2',
|
'E', 'C', 0x04, '4', '<', '>', '2',
|
||||||
'V', 'A', 0x02, 'E', 'X',
|
'V', 'A', 0x02, 'E', 'X',
|
||||||
'R', 'V', 0x02, 0x31, 0x00,
|
'R', 'V', 0x02, 0x1D, 0x00,
|
||||||
PCI_VPD_RESOURCE_END_VAL
|
PCI_VPD_RESOURCE_END_VAL
|
||||||
};
|
};
|
||||||
struct pciVPD exampleVPD = {
|
struct pciVPD exampleVPD = {
|
||||||
|
@ -424,7 +424,7 @@ testPCIVPDGetFieldValueFormat(const void *data G_GNUC_UNUSED)
|
|||||||
|
|
||||||
# define VPD_W_EXAMPLE_FIELDS \
|
# define VPD_W_EXAMPLE_FIELDS \
|
||||||
'V', 'Z', 0x02, '4', '2', \
|
'V', 'Z', 0x02, '4', '2', \
|
||||||
'Y', 'A', 0x04, 'I', 'D', '4', '2', \
|
'Y', 'A', 0x04, '!', '<', '>', ':', \
|
||||||
'Y', 'F', 0x02, 'E', 'X', \
|
'Y', 'F', 0x02, 'E', 'X', \
|
||||||
'Y', 'E', 0x00, \
|
'Y', 'E', 0x00, \
|
||||||
'R', 'W', 0x02, 0x00, 0x00
|
'R', 'W', 0x02, 0x00, 0x00
|
||||||
@ -579,7 +579,7 @@ testVirPCIVPDParseFullVPD(const void *opaque G_GNUC_UNUSED)
|
|||||||
if (testVirPCIVPDValidateExampleReadOnlyFields(res))
|
if (testVirPCIVPDValidateExampleReadOnlyFields(res))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (STRNEQ_NULLABLE(res->rw->asset_tag, "ID42"))
|
if (STRNEQ_NULLABLE(res->rw->asset_tag, "!<>:"))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!res->rw->vendor_specific)
|
if (!res->rw->vendor_specific)
|
||||||
|
Loading…
Reference in New Issue
Block a user