aboutsummaryrefslogtreecommitdiffstats
path: root/test.sh
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2017-10-18 16:25:11 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2017-10-18 16:25:11 +0300
commitb5f332c61b2912b4f048d5d2a38557dedfe7b5fb (patch)
tree6b5be248af039536f78c1a18ed6398baed79079d /test.sh
parentc12fcf17b7acf4a96baab153f5e0951ad58b1d8d (diff)
downloadawall-b5f332c61b2912b4f048d5d2a38557dedfe7b5fb.tar.bz2
awall-b5f332c61b2912b4f048d5d2a38557dedfe7b5fb.tar.xz
test: split to 4 cases
Diffstat (limited to 'test.sh')
-rwxr-xr-xtest.sh20
1 files changed, 18 insertions, 2 deletions
diff --git a/test.sh b/test.sh
index 41d867a..ad3b418 100755
--- a/test.sh
+++ b/test.sh
@@ -9,13 +9,29 @@ cd "$(dirname "$0")"
export LUA_PATH="./?.lua;;"
LUA=lua${LUA_VERSION}
+AWALL="$LUA ./awall-cli"
for cls in mandatory optional private; do
eval "export AWALL_PATH_$(echo $cls | tr a-z A-Z)=test/$cls"
mkdir -p test/$cls
for script in test/$cls/*.lua; do
- [ -f "$script" ] && $LUA "$script" > "${script%.lua}.json"
+ [ -f $script ] && $LUA $script > ${script%.lua}.json
done
done
-exec $LUA ./awall-cli ${1:-diff} -o test/output
+POLICIES=$(ls test/optional/*.json | sed -E 's:^.*/([^/]+).json$:\1:')
+
+for pol in $POLICIES; do
+ $AWALL disable $pol 2>/dev/null
+done
+
+RC=0
+for pol in $POLICIES; do
+ dir=test/output/$pol
+ mkdir -p $dir
+
+ $AWALL enable $pol
+ $AWALL ${1:-diff} -o $dir || RC=1
+ $AWALL disable $pol
+done
+exit $RC