test script for odhcp6-script

This commit is contained in:
Daniel Barlow
2023-09-08 16:50:47 +01:00
parent 353a199ab2
commit b25103be2e
3 changed files with 71 additions and 0 deletions

16
pkgs/odhcp-script/test.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env sh
set -e
statedir=$(mktemp -d)
cleanup(){
test -n "$statedir" && test -d $statedir && rm -rf $statedir
}
trap 'exit 1' INT HUP QUIT TERM ALRM USR1
trap 'cleanup' EXIT
(set -a; . ./test.env ; SERVICE_STATE=$statedir fennelrepl odhcp6-script.fnl ppp0 bound) 10>&1
(cd $statedir && find . -type f | xargs grep '' | sort) > actual
diff -u expected actual
cmp expected actual