[PATCH V5 4/4] Add test cases for parsing of list values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds test cases for parsing of parameters with
multiple occurrances of the same name.

v5:
 - Addressing Eric Blake's comments: added more tests

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>

---
 tests/nwfilterxml2xmlin/attr-value-test.xml  |   27 +++++++++++++++++++++++++++
 tests/nwfilterxml2xmlout/attr-value-test.xml |   22 ++++++++++++++++++++++
 tests/nwfilterxml2xmltest.c                  |    2 ++
 3 files changed, 51 insertions(+)

Index: libvirt-acl/tests/nwfilterxml2xmlin/attr-value-test.xml
===================================================================
--- /dev/null
+++ libvirt-acl/tests/nwfilterxml2xmlin/attr-value-test.xml
@@ -0,0 +1,27 @@
+<filter name='testcase'>
+  <uuid>83011800-f663-96d6-8841-fd836b4318c6</uuid>
+  <filterref filter='clean-traffic'>
+     <parameter name='a' value='1.2.3.4'/>
+     <parameter name='a' value='1.2.3.5'/>
+     <parameter name='c' value='1.1.1.1'/>
+     <parameter name='b' value='1.2.3.10'/>
+     <parameter name='a' value='1.2.3.6'/>
+     <parameter name='b' value='1.2.3.11'/>
+     <parameter name='c' value='2.2.2.2'/>
+     <parameter name='b' value='1.2.3.12'/>
+  </filterref>
+  <rule action='accept' direction='out'>
+     <mac srcmacaddr='1:2:3:4:5:6' srcmacmask='ff:ff:ff:ff:ff:ff'
+     protocolid='arp'/>
+  </rule>
+  <rule action='accept' direction='out'>
+     <tcp srcmacaddr='1:2:3:4:5:6'
+          dstipaddr='10.1.2.3' dstipmask='255.255.255.255'
+          dscp='2'/>
+  </rule>
+  <rule action='accept' direction='out'>
+     <udp-ipv6 srcmacaddr='1:2:3:4:5:6'
+               dstipaddr='a:b:c::d:e:f' dstipmask='128'
+               dscp='2'/>
+  </rule>
+</filter>
Index: libvirt-acl/tests/nwfilterxml2xmlout/attr-value-test.xml
===================================================================
--- /dev/null
+++ libvirt-acl/tests/nwfilterxml2xmlout/attr-value-test.xml
@@ -0,0 +1,22 @@
+<filter name='testcase' chain='root'>
+  <uuid>83011800-f663-96d6-8841-fd836b4318c6</uuid>
+  <filterref filter='clean-traffic'>
+    <parameter name='a' value='1.2.3.4'/>
+    <parameter name='a' value='1.2.3.5'/>
+    <parameter name='a' value='1.2.3.6'/>
+    <parameter name='b' value='1.2.3.10'/>
+    <parameter name='b' value='1.2.3.11'/>
+    <parameter name='b' value='1.2.3.12'/>
+    <parameter name='c' value='1.1.1.1'/>
+    <parameter name='c' value='2.2.2.2'/>
+  </filterref>
+  <rule action='accept' direction='out' priority='500'>
+    <mac srcmacaddr='01:02:03:04:05:06' srcmacmask='ff:ff:ff:ff:ff:ff' protocolid='arp'/>
+  </rule>
+  <rule action='accept' direction='out' priority='500'>
+    <tcp srcmacaddr='01:02:03:04:05:06' dstipaddr='10.1.2.3' dstipmask='32' dscp='2'/>
+  </rule>
+  <rule action='accept' direction='out' priority='500'>
+    <udp-ipv6 srcmacaddr='01:02:03:04:05:06' dstipaddr='a:b:c::d:e:f' dstipmask='128' dscp='2'/>
+  </rule>
+</filter>
Index: libvirt-acl/tests/nwfilterxml2xmltest.c
===================================================================
--- libvirt-acl.orig/tests/nwfilterxml2xmltest.c
+++ libvirt-acl/tests/nwfilterxml2xmltest.c
@@ -150,6 +150,8 @@ mymain(void)
 
     DO_TEST("chain_prefixtest1", true); /* derived from arp-test */
 
+    DO_TEST("attr-value-test", false);
+
     return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]