summaryrefslogtreecommitdiffstats
path: root/tests/echo
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-08-15 01:43:05 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-08-15 12:36:11 +0200
commitb2506e5504fed23ca9229ea398cab8998aa03712 (patch)
treece41bfbe414f660041837fb289799cbb2c2ba1ca /tests/echo
parent0155bc4df3e9985e4784baff7752959e1b817900 (diff)
tests: Merge monitor and echo test suites
The two test suites were pretty similar already, and since echo output is supposed to be identical to monitor output apart from delete commands, they can be merged together with litte effort. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/echo')
-rwxr-xr-xtests/echo/run-tests.sh45
-rw-r--r--tests/echo/testcases/simple.t12
2 files changed, 0 insertions, 57 deletions
diff --git a/tests/echo/run-tests.sh b/tests/echo/run-tests.sh
deleted file mode 100755
index da7934d1..00000000
--- a/tests/echo/run-tests.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-
-cd $(dirname $0)
-nft=../../src/nft
-nft_opts="-nn -a --echo"
-debug=false
-
-debug_echo() {
- $debug || return
-
- echo "$@"
-}
-
-trap "$nft flush ruleset" EXIT
-
-for testcase in testcases/*.t; do
- echo "running tests from file $(basename $testcase)"
- # files are like this:
- #
- # <input command>[;;<output regexp>]
-
- $nft flush ruleset
-
- while read line; do
- [[ -z "$line" || "$line" == "#"* ]] && continue
-
- # XXX: this only works if there is no semicolon in output
- input="${line%;;*}"
- output="${line##*;;}"
-
- [[ -z $output ]] && output="$input"
-
- debug_echo "calling '$nft $nft_opts $input'"
- cmd_out=$($nft $nft_opts $input)
- # strip trailing whitespace (happens when adding a named set)
- cmd_out="${cmd_out% }"
- debug_echo "got output '$cmd_out'"
- [[ $cmd_out == $output ]] || {
- echo "Warning: Output differs:"
- echo "# nft $nft_opts $input"
- echo "- $output"
- echo "+ $cmd_out"
- }
- done <$testcase
-done
diff --git a/tests/echo/testcases/simple.t b/tests/echo/testcases/simple.t
deleted file mode 100644
index 566fd7e0..00000000
--- a/tests/echo/testcases/simple.t
+++ /dev/null
@@ -1,12 +0,0 @@
-add table ip t
-add chain ip t c
-
-# note the added handle output
-add rule ip t c accept;;add rule ip t c accept # handle *
-add rule ip t c tcp dport { 22, 80, 443 } accept;;add rule ip t c tcp dport { 22, 80, 443 } accept # handle *
-
-add set ip t ipset { type ipv4_addr; }
-add element ip t ipset { 192.168.0.1 }
-
-# counter output comes with statistics
-add counter ip t cnt;;add counter ip t cnt *