Skip to contentSkip to conversation

tests: add a wrapper for the filter test case

PATCH New Florian Westphal 1 participant 1 message Mar 9 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 tests: add a wrapper for the filter test case

The test requires traffic + active conntrack to pass. Add a wrapper script that creates a new netns, enables conntrack and then creates traffic (== ctnetlink events).

---
 tests/test_filter.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100755 tests/test_filter.sh
tests/test_filter.sh new file +27 -0
new file mode 100755
index 000000000000..0910a61070ce
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+exec unshare -n bash -c '
+ip link set lo up
+nft -f -<<EOF
+table t {
+	chain c {
+		ct state new accept
+	}
+}
+EOF
+
+timeout 20 ./test_filter | grep -q NEW &
+rp=$!
+sleep 1
+
+for i in $(seq 1 127); do
+	timeout 1 ping -q -c 1 -I 127.0.0.$i 127.0.0.$i
+done > /dev/null
+
+wait $rp
+ret=$?
+
+echo "test_filter: return $ret"
+
+exit $ret
+'
Signature · 1 line
2.52.0