[PATCH xtables 4/4] tests: add a few simple tests for list/new/delete

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

 



Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
---
 .../shell/testcases/ebtables/0001-ebtables-basic_0 | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100755 iptables/tests/shell/testcases/ebtables/0001-ebtables-basic_0

diff --git a/iptables/tests/shell/testcases/ebtables/0001-ebtables-basic_0 b/iptables/tests/shell/testcases/ebtables/0001-ebtables-basic_0
new file mode 100755
index 000000000000..05a2715f53b7
--- /dev/null
+++ b/iptables/tests/shell/testcases/ebtables/0001-ebtables-basic_0
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+set -x
+case "$XT_MULTI" in
+*/xtables-nft-multi)
+	for t in filter nat;do
+		$XT_MULTI ebtables -t $t -L || exit 1
+		$XT_MULTI ebtables -t $t -X || exit 1
+		$XT_MULTI ebtables -t $t -F || exit 1
+	done
+
+	for t in broute foobar ;do
+		$XT_MULTI ebtables -t $t -L &&
+		$XT_MULTI ebtables -t $t -X &&
+		$XT_MULTI ebtables -t $t -F
+		if [ $? -eq 0 ]; then
+			echo "Expect nonzero return for unsupported table"
+			exit 1
+		fi
+	done
+
+
+	$XT_MULTI ebtables -t filter -N FOO || exit 1
+	$XT_MULTI ebtables -t filter -N FOO
+	if [ $? -eq 0 ]; then
+		echo "Duplicate chain FOO"
+		$XT_MULTI ebtables -t filter -L
+		exit 1
+	fi
+
+	$XT_MULTI ebtables -t filter -N BAR || exit 1
+	$XT_MULTI ebtables -t filter -N BAZ || exit 1
+
+	$XT_MULTI ebtables -t filter -L | grep -q FOO || exit 1
+	$XT_MULTI ebtables -t filter -L | grep -q BAR || exit 1
+	$XT_MULTI ebtables -t filter -L | grep -q BAZ || exit 1
+
+	$XT_MULTI ebtables -t filter -L BAZ || exit 1
+	$XT_MULTI ebtables -t filter -X BAZ || exit 1
+	$XT_MULTI ebtables -t filter -L BAZ | grep -q BAZ
+	if [ $? -eq 0 ]; then
+		echo "Deleted chain -L BAZ ok, expected failure"
+		$XT_MULTI ebtables -t filter -L
+		exit 1
+	fi
+
+	$XT_MULTI ebtables -t $t -F || exit 0
+	;;
+*)
+	echo "skip $XT_MULTI"
+	;;
+esac
-- 
2.16.4

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux