]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: add first `nft -f' tests
authorArturo Borrero <arturo.borrero.glez@gmail.com>
Wed, 13 Jan 2016 18:25:46 +0000 (19:25 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 3 Mar 2016 18:54:58 +0000 (19:54 +0100)
This patch add some basic initial tests.

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/nft-f/0001define_slash_0 [new file with mode: 0755]

diff --git a/tests/shell/testcases/nft-f/0001define_slash_0 b/tests/shell/testcases/nft-f/0001define_slash_0
new file mode 100755 (executable)
index 0000000..4ce7089
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# tests for commit 85d6803 (parser_bison: initializer_expr must use rhs_expr)
+
+MKTEMP=$(which mktemp)
+if [ -x $MKTEMP ] ; then
+       tmpfile=$(${MKTEMP})
+else
+       tmpfile=$(/tmp/${RANDOM})
+fi
+
+if [ ! -w $tmpfile ] ; then
+       echo "Failed to create tmp file" >&2
+       exit 0
+fi
+
+trap "rm -rf $tmpfile" EXIT # cleanup if aborted
+
+echo "
+define net = 1.1.1.1/24
+" > $tmpfile
+
+set -e
+
+$NFT -f $tmpfile