---
tests/shell/testcases/include/0016sibling_scopes_0 | 33 ++++++++++++++++++
.../shell/testcases/include/0017scope_hierarchy_0 | 39 ++++++++++++++++++++++
tests/shell/testcases/include/0018global_define_0 | 38 +++++++++++++++++++++
tests/shell/testcases/include/0019global_define_1 | 20 +++++++++++
.../include/dumps/0016sibling_scopes_0.nft | 0
.../include/dumps/0017scope_hierarchy_0.nft | 0
.../include/dumps/0018global_define_0.nft | 0
7 files changed, 130 insertions(+)
create mode 100755 tests/shell/testcases/include/0016sibling_scopes_0
create mode 100755 tests/shell/testcases/include/0017scope_hierarchy_0
create mode 100755 tests/shell/testcases/include/0018global_define_0
create mode 100755 tests/shell/testcases/include/0019global_define_1
create mode 100644 tests/shell/testcases/include/dumps/0016sibling_scopes_0.nft
create mode 100644
tests/shell/testcases/include/dumps/0017scope_hierarchy_0.nft
create mode 100644 tests/shell/testcases/include/dumps/0018global_define_0.nft
diff --git a/tests/shell/testcases/include/0016sibling_scopes_0
b/tests/shell/testcases/include/0016sibling_scopes_0
new file mode 100755
index 0000000..c8b4d7f
--- /dev/null
+++ b/tests/shell/testcases/include/0016sibling_scopes_0
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -e
+
+tmpdir=$(mktemp -d)
+if [ ! -d $tmpdir ] ; then
+ echo "Failed to create tmp directory" >&2
+ exit 0
+fi
+
+# cleanup if aborted
+trap "rm -rf $tmpdir" EXIT
+
+cat > $tmpdir/top.nft << EOF
+include "$tmpdir/a.nft"
+include "$tmpdir/b.nft"
+
+EOF
+
+cat > $tmpdir/a.nft << EOF
+define AAA = "testa"
+EOF
+
+cat > $tmpdir/b.nft << EOF
+define AAA = "testb"
+EOF
+
+$NFT -f $tmpdir/top.nft
+
+if [ $? -ne 0 ] ; then
+ echo "E: unable to load good ruleset" >&2
+ exit 1
+fi
\ No newline at end of file
diff --git a/tests/shell/testcases/include/0017scope_hierarchy_0
b/tests/shell/testcases/include/0017scope_hierarchy_0
new file mode 100755
index 0000000..ba99a58
--- /dev/null
+++ b/tests/shell/testcases/include/0017scope_hierarchy_0
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+set -e
+
+tmpdir=$(mktemp -d)
+if [ ! -d $tmpdir ] ; then
+ echo "Failed to create tmp directory" >&2
+ exit 0
+fi
+
+# cleanup if aborted
+trap "rm -rf $tmpdir" EXIT
+
+cat > $tmpdir/top.nft << EOF
+define TOP = "top"
+include "$tmpdir/a.nft"
+EOF
+
+cat > $tmpdir/a.nft << EOF
+define AAA = "testa"
+include "$tmpdir/sub/*.nft"
+EOF
+
+mkdir $tmpdir/sub &> /dev/null
+
+cat > $tmpdir/sub/b.nft << EOF
+define FOO = { \$TOP, abc }
+EOF
+
+cat > $tmpdir/sub/c.nft << EOF
+define BAR = { \$AAA, cdef }
+EOF
+
+$NFT -f $tmpdir/top.nft
+
+if [ $? -ne 0 ] ; then
+ echo "E: unable to load good ruleset" >&2
+ exit 1
+fi
\ No newline at end of file
diff --git a/tests/shell/testcases/include/0018global_define_0
b/tests/shell/testcases/include/0018global_define_0
new file mode 100755
index 0000000..4288862
--- /dev/null
+++ b/tests/shell/testcases/include/0018global_define_0
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+set -e
+
+tmpdir=$(mktemp -d)
+if [ ! -d $tmpdir ] ; then
+ echo "Failed to create tmp directory" >&2
+ exit 0
+fi
+
+# cleanup if aborted
+trap "rm -rf $tmpdir" EXIT
+
+cat > $tmpdir/top.nft << EOF
+define TOP = "top"
+include "$tmpdir/a.nft"
+define CCC = \$BBB
+global undefine BBB
+EOF
+
+cat > $tmpdir/a.nft << EOF
+define AAA = "testa"
+include "$tmpdir/sub/b.nft"
+EOF
+
+mkdir $tmpdir/sub &> /dev/null
+
+cat > $tmpdir/sub/b.nft << EOF
+global define BBB = "global"
+global redefine BBB = "global2"
+EOF
+
+$NFT -f $tmpdir/top.nft
+
+if [ $? -ne 0 ] ; then
+ echo "E: unable to load good ruleset" >&2
+ exit 1
+fi
diff --git a/tests/shell/testcases/include/0019global_define_1
b/tests/shell/testcases/include/0019global_define_1
new file mode 100755
index 0000000..11d9dd2
--- /dev/null
+++ b/tests/shell/testcases/include/0019global_define_1
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -e
+
+tmpdir=$(mktemp -d)
+if [ ! -d $tmpdir ] ; then
+ echo "Failed to create tmp directory" >&2
+ exit 0
+fi
+
+# cleanup if aborted
+trap "rm -rf $tmpdir" EXIT
+
+cat > $tmpdir/top.nft << EOF
+define TOP = "top"
+global define FAIL = \$TOP
+EOF
+
+$NFT -f $tmpdir/top.nft 2> /dev/null
+echo "E: local variable in global define"
diff --git a/tests/shell/testcases/include/dumps/0016sibling_scopes_0.nft
b/tests/shell/testcases/include/dumps/0016sibling_scopes_0.nft
new file mode 100644
index 0000000..e69de29
diff --git a/tests/shell/testcases/include/dumps/0017scope_hierarchy_0.nft
b/tests/shell/testcases/include/dumps/0017scope_hierarchy_0.nft
new file mode 100644
index 0000000..e69de29
diff --git a/tests/shell/testcases/include/dumps/0018global_define_0.nft
b/tests/shell/testcases/include/dumps/0018global_define_0.nft
new file mode 100644
index 0000000..e69de29
--
2.13.6
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html