]> granicus.if.org Git - ipset/commitdiff
Correct tests to check the number of entries too
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 14 Oct 2016 21:38:30 +0000 (23:38 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 14 Oct 2016 21:38:30 +0000 (23:38 +0200)
Give enough time for the entries to timeout before listing, so that
we get the correct number of entries.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
38 files changed:
tests/comment.t
tests/comment.t.list22
tests/hash:ip,mark.t
tests/hash:ip,mark.t.list1
tests/hash:ip,port,ip.t
tests/hash:ip,port,ip.t.list1
tests/hash:ip,port,net.t
tests/hash:ip,port.t
tests/hash:ip,port.t.list1
tests/hash:ip.t
tests/hash:ip.t.list0
tests/hash:ip.t.list1
tests/hash:ip6,mark.t
tests/hash:ip6,mark.t.list1
tests/hash:ip6,port,ip6.t
tests/hash:ip6,port,ip6.t.list1
tests/hash:ip6,port.t
tests/hash:ip6,port.t.list1
tests/hash:ip6.t
tests/hash:ip6.t.list0
tests/hash:ip6.t.list1
tests/hash:mac.t
tests/hash:mac.t.list0
tests/hash:net,net.t
tests/hash:net,net.t.list1
tests/hash:net,port,net.t
tests/hash:net,port.t
tests/hash:net,port.t.list1
tests/hash:net.t
tests/hash:net.t.list1
tests/hash:net6,net6.t
tests/hash:net6,net6.t.list1
tests/hash:net6,port.t
tests/hash:net6,port.t.list1
tests/hash:net6.t
tests/hash:net6.t.list1
tests/runtest.sh
tests/setlist.t

index 204093a36e4db23054d7792d3415547d35d46c27..130a033e17a6674b73aae4201025b9467bac1442 100644 (file)
 # Hash comment: Destroy test set
 0 ipset destroy test
 # Hash comment: create set with timeout
-0 ipset create test hash:ip comment timeout 5
+0 ipset create test hash:ip comment timeout 4
 # Hash comment: Add multiple elements with default timeout
 0 for x in `seq 0 255`; do echo "add test 2.0.0.$x comment \\\"text message $x\\\""; done | ipset restore
 # Hash comment: Add multiple elements with zero timeout
 0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
 # Hash comment: Check listing
 0 diff -u -I 'Size in memory.*' .foo comment.t.list21
-# Sleep 6s so that entries can time out
-0 sleep 6s
+# Sleep 5s so that entries can time out
+0 sleep 5s
 # Hash comment: List set
 0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
 # Hash comment: Check listing
index 15926f884502bb277d4182340f6f57fd1692900e..9215b0d1a76485b265d0b13b6baf9ddaaf88929c 100644 (file)
@@ -1,9 +1,9 @@
 Name: test
 Type: hash:ip
 Header: family inet hashsize 1024 maxelem 65536 timeout x comment
-Size in memory: 98256
+Size in memory: 57634
 References: 0
-Number of entries: 512
+Number of entries: 256
 Members:
 2.0.1.0 timeout x comment "text message 0"
 2.0.1.1 timeout x comment "text message 1"
index f6bd6ee0a1d3e09eda4f0ce41a76dd22d42fcb8e..9c51201f948eba77e4ff3069ab12636dabed966e 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:ip,mark timeout 5
+0 ipset create test hash:ip,mark timeout 4
 # Add partly zero valued element
 0 ipset add test 2.0.0.1,0x0
 # Test partly zero valued element
index a15cb5204a48751e8a19bb743795bf19bf6fd33f..c959e4cb52fdec44d26711f84d0ab38b18db700a 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:ip,mark
-Header: family inet markmask 0xffffffff hashsize 1024 maxelem 65536 timeout 5
-Size in memory: 640
+Header: family inet markmask 0xffffffff hashsize 1024 maxelem 65536 timeout 4
+Size in memory: 536
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index 0cb2e0bdbe3eed34ce43f3e11be45ee1615aa3f6..8a6954e791a6597adf8f96b6a8eedcca8277ab81 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:ip,port,ip timeout 5
+0 ipset create test hash:ip,port,ip timeout 4
 # Add partly zero valued element
 0 ipset add test 2.0.0.1,0,0.0.0.0
 # Test partly zero valued element
index c88901492c745a08335a53a0f001cf4720228026..7c7d5609042c3d646bcd230577cf7fe104585216 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:ip,port,ip
-Header: family inet hashsize 1024 maxelem 65536 timeout 5
-Size in memory: 840
+Header: family inet hashsize 1024 maxelem 65536 timeout 4
+Size in memory: 664
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index cb68cb80cdd591e0ec6429164b83ff1738a072c6..487f5639eb0b728a5754464c297b06fb9ad46882 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:ip,port,net timeout 5
+0 ipset create test hash:ip,port,net timeout 4
 # Add partly zero valued element
 0 ipset add test 2.0.0.1,0,192.168.0.0/24
 # Test partly zero valued element
index fc5d466aa321eae27ee39c7130c3943d7811e67d..be323e05b52094ca08a02d5879a7c2776f40518d 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:ip,port timeout 5
+0 ipset create test hash:ip,port timeout 4
 # Add partly zero valued element
 0 ipset add test 2.0.0.1,0
 # Test partly zero valued element
index 4442ad63d3c22fbbd9c48de532a4de4f3eb85de6..4b7912426b393ec2868aad3071303742b573f0ad 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:ip,port
-Header: family inet hashsize 1024 maxelem 65536 timeout 5
-Size in memory: 640
+Header: family inet hashsize 1024 maxelem 65536 timeout 4
+Size in memory: 528
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index a3ab1e2f2fc282fbda180717d15f0df2256ef04d..36b82f9cd08d4a0d31a038a9670f7a14cebc47ac 100644 (file)
@@ -1,11 +1,11 @@
 # IP: Create a set with timeout
-0 ipset -N test iphash --hashsize 128 timeout 5
+0 ipset -N test iphash --hashsize 128 timeout 4
 # Range: Add zero valued element
 1 ipset -A test 0.0.0.0
 # Range: Test zero valued element
 1 ipset -T test 0.0.0.0
 # IP: Add first random value
-0 ipset -A test 2.0.0.1 timeout 5
+0 ipset -A test 2.0.0.1 timeout 4
 # IP: Add second random value
 0 ipset -A test 192.168.68.69 timeout 0
 # IP: Test first random value
@@ -41,7 +41,7 @@
 # IP: Delete test set
 0 ipset -X test
 # IP: Restore values so that rehashing is triggered
-0 sed 's/hashsize 128/hashsize 128 timeout 5/' iphash.t.restore | ipset -R
+0 sed 's/hashsize 128/hashsize 128 timeout 4/' iphash.t.restore | ipset -R
 # IP: Check that the values are restored
 0 test `ipset -S test| grep add| wc -l` -eq 129
 # Sleep 5s so that elements can time out
@@ -73,7 +73,7 @@
 # IP: Destroy sets
 0 ipset -X
 # Network: Create a set with timeout
-0 ipset -N test iphash --hashsize 128 --netmask 24 timeout 5
+0 ipset -N test iphash --hashsize 128 --netmask 24 timeout 4
 # Network: Add zero valued element
 1 ipset -A test 0.0.0.0
 # Network: Test zero valued element
index d166f77c7a620a1c7c6a1e029df10f5b16ad9876..1859015866433289955a08947521bf79facb978c 100644 (file)
@@ -1,8 +1,8 @@
 Name: test
 Type: hash:ip
-Header: family inet hashsize 128 maxelem 65536 timeout 5
-Size in memory: 352
+Header: family inet hashsize 128 maxelem 65536 timeout 4
+Size in memory: 336
 References: 0
-Number of entries: 2
+Number of entries: 1
 Members:
 192.168.68.69 timeout 0
index db6827ee5b6d377161c5045fd7fe5c0bcc8b7d56..09773247f81cf761890e221a2e484e751e80124a 100644 (file)
@@ -1,8 +1,8 @@
 Name: test
 Type: hash:ip
-Header: family inet hashsize 128 maxelem 65536 netmask 24 timeout 5
-Size in memory: 464
+Header: family inet hashsize 128 maxelem 65536 netmask 24 timeout 4
+Size in memory: 432
 References: 0
-Number of entries: 3
+Number of entries: 1
 Members:
 200.100.10.0 timeout 0
index d4f9200c749427937de4c03bc80c1f6f8fe2b334..8f50acfd4c067d458a0733e202942664c73bec34 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:ip,mark family inet6 timeout 5
+0 ipset create test hash:ip,mark family inet6 timeout 4
 # Add partly zero valued element
 0 ipset add test 2:0:0::1,0x0
 # Test partly zero valued element
index 377fa7927fafaa1a76857d5650af60846618bd50..5c7b730cea68ef9f0c38a522b9f24feaa8369c5d 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:ip,mark
-Header: family inet6 markmask 0xffffffff hashsize 1024 maxelem 65536 timeout 5
-Size in memory: 1088
+Header: family inet6 markmask 0xffffffff hashsize 1024 maxelem 65536 timeout 4
+Size in memory: 800
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index 6f7f4db14b8382f197fea0b39e061b8bc019936c..e8a75f0399975976172a7f9b07caa842bdd756cd 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:ip,port,ip family inet6 timeout 5
+0 ipset create test hash:ip,port,ip family inet6 timeout 4
 # Add partly zero valued element
 0 ipset add test 2:0:0::1,0,0:0:0::0
 # Test partly zero valued element
index 3d42c1c466dc1a1b9ebccf75c215f715aa114774..d3b61b783d95f5e399c3676871d4aae2937ee694 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:ip,port,ip
-Header: family inet6 hashsize 1024 maxelem 65536 timeout 5
-Size in memory: 1608
+Header: family inet6 hashsize 1024 maxelem 65536 timeout 4
+Size in memory: 1072
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index b142f22e3a7958b94de8e1fb807eac329e97b018..a47ca6e596ff72dd33a36473c97dce1323e44095 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:ip,port family inet6 timeout 5
+0 ipset create test hash:ip,port family inet6 timeout 4
 # Add partly zero valued element
 0 ipset add test 2:0:0::1,0
 # Test partly zero valued element
index 2260fa6816768bb4d7a7bb08f54c8c21220ce5ad..d707af517ecc3e2b7141eb2bf0d8ec51ceb69bc1 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:ip,port
-Header: family inet6 hashsize 1024 maxelem 65536 timeout 5
-Size in memory: 1088
+Header: family inet6 hashsize 1024 maxelem 65536 timeout 4
+Size in memory: 800
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index 2baaa8346c1a1f03e2ab3084568d07ce8d3c3867..5edc267fc616884a3bb8c3cdece3a20c25193d9e 100644 (file)
@@ -1,5 +1,5 @@
 # IP: Create a set with timeout
-0 ipset -N test iphash -6 --hashsize 128 timeout 5
+0 ipset -N test iphash -6 --hashsize 128 timeout 4
 # IP: Add zero valued element
 1 ipset -A test ::
 # IP: Test zero valued element
@@ -7,7 +7,7 @@
 # IP: Delete zero valued element
 1 ipset -D test ::
 # IP: Add first random value
-0 ipset -A test 2:0:0::1 timeout 5
+0 ipset -A test 2:0:0::1 timeout 4
 # IP: Add second random value
 0 ipset -A test 192:168:68::69 timeout 0
 # IP: Test first random value
@@ -47,7 +47,7 @@
 # IP: Delete test set
 0 ipset -X test
 # Network: Create a set with timeout
-0 ipset -N test iphash -6 --hashsize 128 --netmask 64 timeout 5
+0 ipset -N test iphash -6 --hashsize 128 --netmask 64 timeout 4
 # Network: Add zero valued element
 1 ipset -A test ::
 # Network: Test zero valued element
index 30e0c33404b415fac7b142d3b31ed84283376b87..44b6fb42b7875a9e7c484542e4bd00d2c01e08f1 100644 (file)
@@ -1,8 +1,8 @@
 Name: test
 Type: hash:ip
-Header: family inet6 hashsize 128 maxelem 65536 timeout 5
-Size in memory: 512
+Header: family inet6 hashsize 128 maxelem 65536 timeout 4
+Size in memory: 416
 References: 0
-Number of entries: 2
+Number of entries: 1
 Members:
 192:168:68::69 timeout 0
index 337b194244b78900118ef9c6ef901ed9ec3e0030..838fa77c4b8e0295c10b91968d5c2dffa8cf2b68 100644 (file)
@@ -1,8 +1,8 @@
 Name: test
 Type: hash:ip
-Header: family inet6 hashsize 128 maxelem 65536 netmask 64 timeout 5
-Size in memory: 704
+Header: family inet6 hashsize 128 maxelem 65536 netmask 64 timeout 4
+Size in memory: 544
 References: 0
-Number of entries: 3
+Number of entries: 1
 Members:
 200:100:10:: timeout 0
index f7023d0e6a095308e92b2ebe1bfa3cf896b37e30..361bf589d6f41d7980345728c7ef5af531b79b64 100644 (file)
@@ -1,11 +1,11 @@
 # MAC: Create a set with timeout
-0 ipset -N test machash --hashsize 128 timeout 5
+0 ipset -N test machash --hashsize 128 timeout 4
 # Range: Add zero valued element
 1 ipset -A test 0:0:0:0:0:0
 # Range: Test zero valued element
 1 ipset -T test 0:0:0:0:0:0
 # MAC: Add first random value
-0 ipset -A test 0:0:0:0:2:0 timeout 5
+0 ipset -A test 0:0:0:0:2:0 timeout 4
 # MAC: Add second random value
 0 ipset -A test 0:a:0:0:0:0 timeout 0
 # MAC: Test first random value
index 824dd3042010c60ed26bef313600e494bceb4b67..232b932925e3bbe57a73da8f9b7f40d297448cab 100644 (file)
@@ -1,8 +1,8 @@
 Name: test
 Type: hash:mac
-Header: hashsize 128 maxelem 65536 timeout 5
-Size in memory: 384
+Header: hashsize 128 maxelem 65536 timeout 4
+Size in memory: 336
 References: 0
-Number of entries: 2
+Number of entries: 1
 Members:
 00:0A:00:00:00:00 timeout 0
index b63ff323f171150b2d65342c72c986508d13bec3..13f1198175225a5339a936c3dc6be96a2f58039e 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:net,net hashsize 128 timeout 5
+0 ipset create test hash:net,net hashsize 128 timeout 4
 # Add zero valued element
 1 ipset add test 0.0.0.0/0,0.0.0.0/0
 # Test zero valued element
index 262440b22102a1e246d0bc1d8d122d7d6ae63e6b..99e62c1fb7eb5d46d60087f152fe7dc26cf5fc50 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:net,net
-Header: family inet hashsize 128 maxelem 65536 timeout 5
-Size in memory: 1288
+Header: family inet hashsize 128 maxelem 65536 timeout 4
+Size in memory: 920
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index 4b556319206547d8915522fa25b0e2f175b463ed..0e92f5ba3d729e9de6e58fc7fab5746831d7fbed 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:net,port,net timeout 5
+0 ipset create test hash:net,port,net timeout 4
 # Add partly zero valued element
 0 ipset add test 2.0.0.1/24,0,192.168.0.0/24
 # Test partly zero valued element
index d51d27f8c505b1ca78349db483a732ddce8c9808..3c154f99d694b135c2ea867c58f15e144cb53bf6 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:net,port hashsize 128 timeout 5
+0 ipset create test hash:net,port hashsize 128 timeout 4
 # Add zero valued element
 1 ipset add test 0.0.0.0/0,0
 # Test zero valued element
index 2e38e199c47405064bae09b8ae6a460a8ef92662..66f0955e9908c184ffbed1aba2d5cde399661a1a 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:net,port
-Header: family inet hashsize 128 maxelem 65536 timeout 5
-Size in memory: 1024
+Header: family inet hashsize 128 maxelem 65536 timeout 4
+Size in memory: 880
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index 6f54c256441b5c0fe4e3ddc355ffc0a694156b56..e73f29c735ac4e3f715ff5131c0d9184d5c46583 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test nethash hashsize 128 timeout 5
+0 ipset create test nethash hashsize 128 timeout 4
 # Add zero valued element
 1 ipset add test 0.0.0.0/0
 # Test zero valued element
index d96a65882b3a8c9980606b838a8e4563ad4a3a33..6e74a1dce3b465662cf1a61de0bbd7fc9e59cedd 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:net
-Header: family inet hashsize 128 maxelem 65536 timeout 5
-Size in memory: 895
+Header: family inet hashsize 128 maxelem 65536 timeout 4
+Size in memory: 784
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index 3d6f4477121510c39ec585bc6cf637a173a97768..57f8b2a30c24665c74efdaa6e06c5ab79e56a4b2 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:net,net family inet6 hashsize 128 timeout 5
+0 ipset create test hash:net,net family inet6 hashsize 128 timeout 4
 # Add zero valued element
 1 ipset add test ::/0,::/0
 # Test zero valued element
index ecc76b669b36a1ef62098ae4856275c9a889cd85..2ccfd5106ee67360964c79334438532819590722 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:net,net
-Header: family inet6 hashsize 128 maxelem 65536 timeout 5
-Size in memory: 3144
+Header: family inet6 hashsize 128 maxelem 65536 timeout 4
+Size in memory: 2608
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index a47ece73a205a7ef2ed6c9f44d36102fb2b7a85d..e3e65848649abcdb611d862e177fdd35563927fc 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test hash:net,port family inet6 hashsize 128 timeout 5
+0 ipset create test hash:net,port family inet6 hashsize 128 timeout 4
 # Add zero valued element
 1 ipset add test ::/0,tcp:8
 # Test zero valued element
index dc12d8f94ed00d752f79ae17d142169af6216739..788358b01c041d2be62136c9a5dd92a3b30ac7d9 100644 (file)
@@ -1,8 +1,8 @@
 Name: test
 Type: hash:net,port
-Header: family inet6 hashsize 128 maxelem 65536 timeout 5
-Size in memory: 2352
+Header: family inet6 hashsize 128 maxelem 65536 timeout 4
+Size in memory: 1984
 References: 0
-Number of entries: 5
+Number of entries: 1
 Members:
 1:1:1::1,tcp:8 timeout 0
index fc377f49ab9915f3e56a340e0ee98cc10a18b5cd..7a476550f602c58e09ba02c99005c7d21274fec7 100644 (file)
@@ -1,5 +1,5 @@
 # Create a set with timeout
-0 ipset create test nethash family inet6 hashsize 128 timeout 5
+0 ipset create test nethash family inet6 hashsize 128 timeout 4
 # Add zero valued element
 1 ipset add test ::/0
 # Test zero valued element
index 20a4950073a6ed3ab5afe713e849cb1ae4a1566b..bf7dd88651ed8c5a1c625a3724eac795cad821a7 100644 (file)
@@ -1,7 +1,7 @@
 Name: test
 Type: hash:net
-Header: family inet6 hashsize 128 maxelem 65536 timeout 5
-Size in memory: 2112
+Header: family inet6 hashsize 128 maxelem 65536 timeout 4
+Size in memory: 1824
 References: 0
-Number of entries: 4
+Number of entries: 0
 Members:
index 05550c668733e1302c7b4b17414b4a72c44d3d73..6f5a250097d88c42a6494f4d1c57d76a3dcd0826 100755 (executable)
@@ -83,7 +83,7 @@ for types in $tests; do
                continue
                ;;
            skip)
-               eval $cmd
+               eval $cmd >/dev/null
                if [ $? -ne 0 ]; then
                        echo "Skipping tests, '$cmd' failed"
                        break
index 5e69fb377f137ee49fcbabf3d59cb42ad5048c76..7d14ec85b438406022d01f30cc57228ff3a90c67 100644 (file)
@@ -81,7 +81,7 @@
 # Check listing
 0 diff -u -I 'Size in memory.*' .foo setlist.t.list3
 # List all sets
-0 ipset list | grep -v Revision: > .foo
+0 sleep .1s; ipset list | grep -v Revision: > .foo
 # Check listing
 0 diff -u -I 'Size in memory.*' .foo setlist.t.list4
 # Flush sets
 # Delete set from the set
 0 ipset del test a
 # Check reference number of deleted set
-0 ref=`ipset list a | grep References | sed 's/References: //'` && test $ref -eq 0
+0 ref=`sleep .1s; ipset list a | grep References | sed 's/References: //'` && test $ref -eq 0
 # Add element to set a
 0 ipset add a 1.1.1.1
 # Swap sets