test.sh (656B)
1 #!/usr/bin/env sh 2 set -e 3 4 statedir=$(mktemp -d) 5 6 cleanup(){ 7 test -n "$statedir" && test -d $statedir && rm -rf $statedir 8 } 9 trap 'exit 1' INT HUP QUIT TERM ALRM USR1 10 trap 'cleanup' EXIT 11 12 # call the script twice with different state, to test that it cleans 13 # out old values when it runs again 14 15 (set -a; . ./test.env ; ADDRESSES=2001:80:111:111:0:fff:123:567/128,3600,7200 SERVICE_STATE=$statedir fennelrepl odhcp6-script.fnl ppp0 bound) 10>&1 16 17 (set -a; . ./test.env ; SERVICE_STATE=$statedir fennelrepl odhcp6-script.fnl ppp0 bound) 10>&1 18 19 (cd $statedir && find . -type f | xargs grep '' | sort) > actual 20 diff -u expected actual 21 cmp expected actual