summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/iphash.t14
-rw-r--r--tests/iphash.t.list07
-rw-r--r--tests/iphash.t.list17
-rw-r--r--tests/ipmap.t16
-rw-r--r--tests/ipmap.t.list08
-rw-r--r--tests/ipmap.t.list18
-rw-r--r--tests/ipmap.t.list28
-rw-r--r--tests/ipmap.t.list38
-rw-r--r--tests/ipporthash.t8
-rw-r--r--tests/ipporthash.t.list07
-rw-r--r--tests/ipporthash.t.list17
-rw-r--r--tests/ipportiphash.t8
-rw-r--r--tests/ipportiphash.t.list07
-rw-r--r--tests/ipportiphash.t.list17
-rw-r--r--tests/ipportnethash.t8
-rw-r--r--tests/ipportnethash.t.list07
-rw-r--r--tests/ipportnethash.t.list17
-rw-r--r--tests/iptree.t4
-rw-r--r--tests/iptree.t.list08
-rw-r--r--tests/iptreemap.t4
-rw-r--r--tests/iptreemap.t.list011
-rw-r--r--tests/macipmap.t8
-rw-r--r--tests/macipmap.t.list09
-rw-r--r--tests/macipmap.t.list18
-rw-r--r--tests/nethash.t16
-rw-r--r--tests/nethash.t.list07
-rw-r--r--tests/portmap.t8
-rw-r--r--tests/portmap.t.list08
-rw-r--r--tests/portmap.t.list18
-rw-r--r--tests/setlist.t4
-rw-r--r--tests/setlist.t.list08
-rwxr-xr-xtests/sort.sh5
32 files changed, 249 insertions, 9 deletions
diff --git a/tests/iphash.t b/tests/iphash.t
index 4c33ce3..7a3ce1f 100644
--- a/tests/iphash.t
+++ b/tests/iphash.t
@@ -14,6 +14,10 @@
0 ipset -T test 192.168.68.69
# IP: Test value not added to the set
1 ipset -T test 2.0.0.2
+# IP: List set
+0 ipset -L test > .foo0 && ./sort.sh .foo0
+# IP: Check listing
+0 diff .foo iphash.t.list0 && rm .foo
# IP: Flush test set
0 ipset -F test
# IP: Delete test set
@@ -28,11 +32,11 @@
0 ipset -X test
# Network: Create a set
0 ipset -N test iphash --hashsize 128 --netmask 24
-# Range: Add zero valued element
+# Network: Add zero valued element
2 ipset -A test 0.0.0.0
-# Range: Test zero valued element
+# Network: Test zero valued element
2 ipset -T test 0.0.0.0
-# Range: Delete zero valued element
+# Network: Delete zero valued element
2 ipset -D test 0.0.0.0
# Network: Add first random network
0 ipset -A test 2.0.0.1
@@ -44,6 +48,10 @@
0 ipset -T test 192.168.68.95
# Network: Test value not added to the set
1 ipset -T test 2.0.1.0
+# Network: List set
+0 ipset -L test > .foo0 && ./sort.sh .foo0
+# Network: Check listing
+0 diff .foo iphash.t.list1 && rm .foo
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
diff --git a/tests/iphash.t.list0 b/tests/iphash.t.list0
new file mode 100644
index 0000000..93d51c2
--- /dev/null
+++ b/tests/iphash.t.list0
@@ -0,0 +1,7 @@
+Name: test
+Type: iphash
+References: 0
+Header: hashsize: 128 probes: 8 resize: 50
+Members:
+192.168.68.69
+2.0.0.1
diff --git a/tests/iphash.t.list1 b/tests/iphash.t.list1
new file mode 100644
index 0000000..7f13c1c
--- /dev/null
+++ b/tests/iphash.t.list1
@@ -0,0 +1,7 @@
+Name: test
+Type: iphash
+References: 0
+Header: hashsize: 128 probes: 8 resize: 50 netmask: 24
+Members:
+192.168.68.0
+2.0.0.0
diff --git a/tests/ipmap.t b/tests/ipmap.t
index 58b913a..239cef9 100644
--- a/tests/ipmap.t
+++ b/tests/ipmap.t
@@ -20,6 +20,10 @@
1 ipset -A test 2.0.0.0
# Range: Try to add value after upper boundary
1 ipset -A test 2.1.0.1
+# Range: List set
+0 ipset -L test > .foo
+# Range: Check listing
+0 diff .foo ipmap.t.list0 && rm .foo
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
@@ -46,6 +50,10 @@
1 ipset -A test 1.255.255.255
# Network: Try to add value after upper boundary
1 ipset -A test 2.1.0.0
+# Network: List set
+0 ipset -L test > .foo
+# Network: Check listing
+0 diff .foo ipmap.t.list1 && rm .foo
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
@@ -70,6 +78,10 @@
1 ipset -A test 9.255.255.255
# Subnets: Try to add value after upper boundary
1 ipset -A test 11.0.0.0
+# Subnets: List set
+0 ipset -L test > .foo
+# Subnets: Check listing
+0 diff .foo ipmap.t.list2 && rm .foo
# Subnets: FLush test set
0 ipset -F test
# Subnets: Delete test set
@@ -86,6 +98,10 @@
0 ipset -T test 255.255.255.255
# Full: Test value not added to the set
1 ipset -T test 0.1.0.0
+# Full: List set
+0 ipset -L test > .foo
+# Full: Check listing
+0 diff .foo ipmap.t.list3 && rm .foo
# Full: Delete test set
0 ipset -X test
# eof
diff --git a/tests/ipmap.t.list0 b/tests/ipmap.t.list0
new file mode 100644
index 0000000..aeaa4fb
--- /dev/null
+++ b/tests/ipmap.t.list0
@@ -0,0 +1,8 @@
+Name: test
+Type: ipmap
+References: 0
+Header: from: 2.0.0.1 to: 2.1.0.0
+Members:
+2.0.0.1
+2.1.0.0
+
diff --git a/tests/ipmap.t.list1 b/tests/ipmap.t.list1
new file mode 100644
index 0000000..53b76b6
--- /dev/null
+++ b/tests/ipmap.t.list1
@@ -0,0 +1,8 @@
+Name: test
+Type: ipmap
+References: 0
+Header: from: 2.0.0.0 to: 2.0.255.255
+Members:
+2.0.0.0
+2.0.255.255
+
diff --git a/tests/ipmap.t.list2 b/tests/ipmap.t.list2
new file mode 100644
index 0000000..695254b
--- /dev/null
+++ b/tests/ipmap.t.list2
@@ -0,0 +1,8 @@
+Name: test
+Type: ipmap
+References: 0
+Header: from: 10.0.0.0 to: 10.255.255.255 netmask: 24
+Members:
+10.0.0.0
+10.255.255.0
+
diff --git a/tests/ipmap.t.list3 b/tests/ipmap.t.list3
new file mode 100644
index 0000000..3d95091
--- /dev/null
+++ b/tests/ipmap.t.list3
@@ -0,0 +1,8 @@
+Name: test
+Type: ipmap
+References: 0
+Header: from: 0.0.0.0 to: 255.255.255.255 netmask: 16
+Members:
+0.0.0.0
+255.255.0.0
+
diff --git a/tests/ipporthash.t b/tests/ipporthash.t
index 74fed1a..7c622bb 100644
--- a/tests/ipporthash.t
+++ b/tests/ipporthash.t
@@ -28,6 +28,10 @@
1 ipset -A test 2.0.0.0,5
# Range: Try to add value after upper boundary
1 ipset -A test 2.1.0.1,128
+# Range: List set
+0 ipset -L test > .foo0 && ./sort.sh .foo0
+# Range: Check listing
+0 diff .foo ipporthash.t.list0 && rm .foo
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
@@ -56,6 +60,10 @@
1 ipset -A test 1.255.255.255,5
# Network: Try to add value after upper boundary
1 ipset -A test 2.1.0.0,128
+# Network: List set
+0 ipset -L test > .foo0 && ./sort.sh .foo0
+# Network: Check listing
+0 diff .foo ipporthash.t.list1 && rm .foo
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
diff --git a/tests/ipporthash.t.list0 b/tests/ipporthash.t.list0
new file mode 100644
index 0000000..b840a94
--- /dev/null
+++ b/tests/ipporthash.t.list0
@@ -0,0 +1,7 @@
+Name: test
+Type: ipporthash
+References: 0
+Header: from: 2.0.0.1 to: 2.1.0.0 hashsize: 1024 probes: 8 resize: 50
+Members:
+2.0.0.1,5
+2.1.0.0,128
diff --git a/tests/ipporthash.t.list1 b/tests/ipporthash.t.list1
new file mode 100644
index 0000000..be86cda
--- /dev/null
+++ b/tests/ipporthash.t.list1
@@ -0,0 +1,7 @@
+Name: test
+Type: ipporthash
+References: 0
+Header: from: 2.0.0.0 to: 2.0.255.255 hashsize: 1024 probes: 8 resize: 50
+Members:
+2.0.0.0,5
+2.0.255.255,128
diff --git a/tests/ipportiphash.t b/tests/ipportiphash.t
index c7c25e5..860d5a6 100644
--- a/tests/ipportiphash.t
+++ b/tests/ipportiphash.t
@@ -36,6 +36,10 @@
1 ipset -A test 2.0.0.0,5,1.1.1.1
# Range: Try to add value after upper boundary
1 ipset -A test 2.1.0.1,128,2.2.2.2
+# Range: List set
+0 ipset -L test > .foo0 && ./sort.sh .foo0
+# Range: Check listing
+0 diff .foo ipportiphash.t.list0 && rm .foo
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
@@ -64,6 +68,10 @@
1 ipset -A test 1.255.255.255,5,1.1.1.1
# Network: Try to add value after upper boundary
1 ipset -A test 2.1.0.0,128,2.2.2.2
+# Network: List set
+0 ipset -L test > .foo0 && ./sort.sh .foo0
+# Network: Check listing
+0 diff .foo ipportiphash.t.list1 && rm .foo
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
diff --git a/tests/ipportiphash.t.list0 b/tests/ipportiphash.t.list0
new file mode 100644
index 0000000..acb1041
--- /dev/null
+++ b/tests/ipportiphash.t.list0
@@ -0,0 +1,7 @@
+Name: test
+Type: ipportiphash
+References: 0
+Header: from: 2.0.0.1 to: 2.1.0.0 hashsize: 1024 probes: 8 resize: 50
+Members:
+2.0.0.1,5,1.1.1.1
+2.1.0.0,128,2.2.2.2
diff --git a/tests/ipportiphash.t.list1 b/tests/ipportiphash.t.list1
new file mode 100644
index 0000000..5545078
--- /dev/null
+++ b/tests/ipportiphash.t.list1
@@ -0,0 +1,7 @@
+Name: test
+Type: ipportiphash
+References: 0
+Header: from: 2.0.0.0 to: 2.0.255.255 hashsize: 1024 probes: 8 resize: 50
+Members:
+2.0.0.0,5,1.1.1.1
+2.0.255.255,128,2.2.2.2
diff --git a/tests/ipportnethash.t b/tests/ipportnethash.t
index 0b87dad..93369ef 100644
--- a/tests/ipportnethash.t
+++ b/tests/ipportnethash.t
@@ -36,6 +36,10 @@
1 ipset -A test 2.0.0.0,5,1.1.1.1/24
# Range: Try to add value after upper boundary
1 ipset -A test 2.1.0.1,128,2.2.2.2/12
+# Range: List set
+0 ipset -L test > .foo0 && ./sort.sh .foo0
+# Range: Check listing
+0 diff .foo ipportnethash.t.list0 && rm .foo
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
@@ -64,6 +68,10 @@
1 ipset -A test 1.255.255.255,5,1.1.1.1/24
# Network: Try to add value after upper boundary
1 ipset -A test 2.1.0.0,128,2.2.2.2/12
+# Network: List set
+0 ipset -L test > .foo0 && ./sort.sh .foo0
+# Network: Check listing
+0 diff .foo ipportnethash.t.list1 && rm .foo
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
diff --git a/tests/ipportnethash.t.list0 b/tests/ipportnethash.t.list0
new file mode 100644
index 0000000..9727d20
--- /dev/null
+++ b/tests/ipportnethash.t.list0
@@ -0,0 +1,7 @@
+Name: test
+Type: ipportnethash
+References: 0
+Header: from: 2.0.0.1 to: 2.1.0.0 hashsize: 1024 probes: 8 resize: 50
+Members:
+2.0.0.1,5,1.1.1.0/24
+2.1.0.0,128,2.0.0.0/12
diff --git a/tests/ipportnethash.t.list1 b/tests/ipportnethash.t.list1
new file mode 100644
index 0000000..ad861d4
--- /dev/null
+++ b/tests/ipportnethash.t.list1
@@ -0,0 +1,7 @@
+Name: test
+Type: ipportnethash
+References: 0
+Header: from: 2.0.0.0 to: 2.0.255.255 hashsize: 1024 probes: 8 resize: 50
+Members:
+2.0.0.0,5,1.1.1.0/24
+2.0.255.255,128,2.0.0.0/12
diff --git a/tests/iptree.t b/tests/iptree.t
index 746baed..3cb0e00 100644
--- a/tests/iptree.t
+++ b/tests/iptree.t
@@ -12,6 +12,10 @@
1 ipset -T test 2.0.0.2
# Static: Test value not added to the set
1 ipset -T test 192.168.68.70
+# Static: List set
+0 ipset -L test > .foo
+# Static: Check listing
+0 diff .foo iptree.t.list0 && rm .foo
# Static: Flush test set
0 ipset -F test
# Static: Delete test set
diff --git a/tests/iptree.t.list0 b/tests/iptree.t.list0
new file mode 100644
index 0000000..07433b9
--- /dev/null
+++ b/tests/iptree.t.list0
@@ -0,0 +1,8 @@
+Name: test
+Type: iptree
+References: 0
+Header:
+Members:
+2.0.0.1
+192.168.68.69
+
diff --git a/tests/iptreemap.t b/tests/iptreemap.t
index b563522..2e9fce7 100644
--- a/tests/iptreemap.t
+++ b/tests/iptreemap.t
@@ -46,6 +46,10 @@
0 ipset -T test 192.168.68.67
# Test element after upper bound of deleted network
0 ipset -T test 192.168.68.72
+# List set
+0 ipset -L test > .foo
+# Check listing
+0 diff .foo iptreemap.t.list0 && rm .foo
# Flush test set
0 ipset -F test
# Delete test set
diff --git a/tests/iptreemap.t.list0 b/tests/iptreemap.t.list0
new file mode 100644
index 0000000..6e783a0
--- /dev/null
+++ b/tests/iptreemap.t.list0
@@ -0,0 +1,11 @@
+Name: test
+Type: iptreemap
+References: 0
+Header: gc: 300
+Members:
+2.0.0.1
+3.0.0.0
+3.0.0.2
+192.168.68.64-192.168.68.67
+192.168.68.72-192.168.68.95
+
diff --git a/tests/macipmap.t b/tests/macipmap.t
index a498a4f..d088958 100644
--- a/tests/macipmap.t
+++ b/tests/macipmap.t
@@ -26,6 +26,10 @@
1 ipset -T test 2.0.0.2,00:11:22:33:44:56
# Range: Test value with valid MAC
0 ipset -T test 2.0.0.2,00:11:22:33:44:55
+# Range: List set
+0 ipset -L test > .foo
+# Range: Check listing
+0 diff .foo macipmap.t.list0 && rm .foo
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
@@ -52,6 +56,10 @@
1 ipset -A test 1.255.255.255
# Network: Try to add value after upper boundary
1 ipset -A test 2.1.0.0
+# Network: List set
+0 ipset -L test > .foo
+# Network: Check listing
+0 diff .foo macipmap.t.list1 && rm .foo
# Network: Flush test set
0 ipset -F test
# Network: Delete test set
diff --git a/tests/macipmap.t.list0 b/tests/macipmap.t.list0
new file mode 100644
index 0000000..157ba53
--- /dev/null
+++ b/tests/macipmap.t.list0
@@ -0,0 +1,9 @@
+Name: test
+Type: macipmap
+References: 0
+Header: from: 2.0.0.1 to: 2.1.0.0
+Members:
+2.0.0.1,00:00:00:00:00:00
+2.0.0.2,00:11:22:33:44:55
+2.1.0.0,00:00:00:00:00:00
+
diff --git a/tests/macipmap.t.list1 b/tests/macipmap.t.list1
new file mode 100644
index 0000000..dc0dc75
--- /dev/null
+++ b/tests/macipmap.t.list1
@@ -0,0 +1,8 @@
+Name: test
+Type: macipmap
+References: 0
+Header: from: 2.0.0.0 to: 2.0.255.255
+Members:
+2.0.0.0,00:00:00:00:00:00
+2.0.255.255,00:00:00:00:00:00
+
diff --git a/tests/nethash.t b/tests/nethash.t
index b2f234e..cedcfde 100644
--- a/tests/nethash.t
+++ b/tests/nethash.t
@@ -16,18 +16,22 @@
0 ipset -T test 0.0.0.0/1
# Range: Delete almost zero valued element
0 ipset -D test 0.0.0.0/1
-# Add first random network
+# Range: Add first random network
0 ipset -A test 2.0.0.1/24
-# Add second random network
+# Range: Add second random network
0 ipset -A test 192.168.68.69/27
-# Test first random value
+# Range: Test first random value
0 ipset -T test 2.0.0.255
-# Test second random value
+# Range: Test second random value
0 ipset -T test 192.168.68.95
-# Test value not added to the set
+# Range: Test value not added to the set
1 ipset -T test 2.0.1.0
-# Try to add IP address
+# Range: Try to add IP address
2 ipset -A test 2.0.0.1
+# Range: List set
+0 ipset -L test > .foo0 && ./sort.sh .foo0
+# Range: Check listing
+0 diff .foo nethash.t.list0 && rm .foo
# Flush test set
0 ipset -F test
# Delete test set
diff --git a/tests/nethash.t.list0 b/tests/nethash.t.list0
new file mode 100644
index 0000000..0b008b8
--- /dev/null
+++ b/tests/nethash.t.list0
@@ -0,0 +1,7 @@
+Name: test
+Type: nethash
+References: 0
+Header: hashsize: 128 probes: 4 resize: 50
+Members:
+192.168.68.64/27
+2.0.0.0/24
diff --git a/tests/portmap.t b/tests/portmap.t
index 299877a..12cdc1f 100644
--- a/tests/portmap.t
+++ b/tests/portmap.t
@@ -18,6 +18,10 @@
1 ipset -A test 0
# Range: Try to add value after upper boundary
1 ipset -A test 1025
+# Range: List set
+0 ipset -L test > .foo
+# Range: Check listing
+0 diff .foo portmap.t.list0 && rm .foo
# Range: Flush test set
0 ipset -F test
# Range: Delete test set
@@ -34,6 +38,10 @@
0 ipset -T test 65535
# Full: Test value not added to the set
1 ipset -T test 1
+# Full: List set
+0 ipset -L test > .foo
+# Full: Check listing
+0 diff .foo portmap.t.list1 && rm .foo
# Full: Flush test set
0 ipset -F test
# Full: Delete test set
diff --git a/tests/portmap.t.list0 b/tests/portmap.t.list0
new file mode 100644
index 0000000..809ffe1
--- /dev/null
+++ b/tests/portmap.t.list0
@@ -0,0 +1,8 @@
+Name: test
+Type: portmap
+References: 0
+Header: from: 1 to: 1024
+Members:
+1
+1024
+
diff --git a/tests/portmap.t.list1 b/tests/portmap.t.list1
new file mode 100644
index 0000000..9c9b38d
--- /dev/null
+++ b/tests/portmap.t.list1
@@ -0,0 +1,8 @@
+Name: test
+Type: portmap
+References: 0
+Header: from: 0 to: 65535
+Members:
+0
+65535
+
diff --git a/tests/setlist.t b/tests/setlist.t
index d677863..ed21396 100644
--- a/tests/setlist.t
+++ b/tests/setlist.t
@@ -38,6 +38,10 @@
0 ipset -X
# Setlist: Restore saved sets
0 ipset -R < setlist.t.restore
+# Setlist: List set
+0 ipset -L test > .foo
+# Setlist: Check listing
+0 diff .foo setlist.t.list0 && rm .foo
# Setlist: Flush all sets
0 ipset -F
# Setlist: Delete all sets
diff --git a/tests/setlist.t.list0 b/tests/setlist.t.list0
new file mode 100644
index 0000000..9b70446
--- /dev/null
+++ b/tests/setlist.t.list0
@@ -0,0 +1,8 @@
+Name: test
+Type: setlist
+References: 0
+Header: size: 8
+Members:
+foo
+bar
+
diff --git a/tests/sort.sh b/tests/sort.sh
new file mode 100755
index 0000000..a01d066
--- /dev/null
+++ b/tests/sort.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+awk '/^[A-Za-z]+:/ { print $0 }' $1 > .foo
+awk '!/^[A-Za-z]+:/ && !/inding/ { print $0 }' | sort >> .foo
+rm $1