mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
nwfilterxml2xmltest: Add test case for parser and formatter quirks
The parser and formatter for nwfilter rules is very strange and has weird quirks. Add a test case trying to capture some of the quirks to visualize how it will change when the code is refactored. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
dcd49d2cd6
commit
7abf1d864b
13
tests/nwfilterxml2xmlin/quirks-invalid.xml
Normal file
13
tests/nwfilterxml2xmlin/quirks-invalid.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<filter name='testcase'>
|
||||||
|
<uuid>01a992d2-f8c8-7c27-f69b-ab0a9d377379</uuid>
|
||||||
|
|
||||||
|
<!-- quirky XML for parser validation -->
|
||||||
|
<rule action='accept' direction='in' priority='100'>
|
||||||
|
<tcp match='no' srcipaddr='10.1.2.3'/>
|
||||||
|
<tcp match='no' srcportstart='22'/>
|
||||||
|
<tcp dstportstart='22' comment='comment'/>
|
||||||
|
<tcp match='no' srcporttend='24'/>
|
||||||
|
<tcp srcipmask='32' dstporttend='24'/>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
</filter>
|
7
tests/nwfilterxml2xmlout/quirks-invalid.xml
Normal file
7
tests/nwfilterxml2xmlout/quirks-invalid.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<filter name='testcase' chain='root'>
|
||||||
|
<uuid>01a992d2-f8c8-7c27-f69b-ab0a9d377379</uuid>
|
||||||
|
<rule action='accept' direction='in' priority='100'>
|
||||||
|
<tcp match='no' srcipaddr='10.1.2.3' srcipmask='32' srcportstart='22' dstportstart='22'/>
|
||||||
|
<tcp comment='comment'/>
|
||||||
|
</rule>
|
||||||
|
</filter>
|
@ -117,6 +117,11 @@ mymain(void)
|
|||||||
DO_TEST("example-1", false);
|
DO_TEST("example-1", false);
|
||||||
DO_TEST("example-2", false);
|
DO_TEST("example-2", false);
|
||||||
|
|
||||||
|
/* The parser and formatter for nwfilter rules was written in a quirky way.
|
||||||
|
* Validate that it still works. Note that the files don't conform to the
|
||||||
|
* schema */
|
||||||
|
DO_TEST("quirks-invalid", false);
|
||||||
|
|
||||||
DO_TEST("chain_prefixtest1-invalid", true); /* derived from arp-test */
|
DO_TEST("chain_prefixtest1-invalid", true); /* derived from arp-test */
|
||||||
|
|
||||||
DO_TEST("attr-value-test", false);
|
DO_TEST("attr-value-test", false);
|
||||||
|
Loading…
Reference in New Issue
Block a user