1# #-- pylib.test --# 2# source the master var file when it's there 3[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master 4# use .tpkg.var.test for in test variable passing 5[ -f .tpkg.var.test ] && source .tpkg.var.test 6 7PRE="../.." 8if grep "define WITH_PYUNBOUND 1" $PRE/config.h; then 9 echo "have pyunbound" 10else 11 echo "no pyunbound" 12 exit 0 13fi 14 15if test "`uname 2>&1`" = "Darwin"; then 16 echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:../../.libs" 17 export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:../../.libs" 18fi 19#echo export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../../.libs:." 20#export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../../.libs:." 21 22if grep "PY_MAJOR_VERSION=3" $PRE/Makefile; then 23 PYTHON="python3"; else PYTHON="python2"; fi 24if test ! -x `which $PYTHON` 2>&1; then PYTHON="python"; fi 25 26# do the test 27echo "> pylib.lookup.py www.example.com." 28$PYTHON pylib.lookup.py www.example.com. | tee outfile 29 30echo "> cat logfiles" 31cat fwd.log 32echo "> check answer" 33if grep "Resolve: \[.\?10.20.30.40.\?\]" outfile; then 34 : 35else 36 echo "Not OK (resolve)" 37 exit 1 38fi 39if grep "Async resolve: \[.\?10.20.30.40.\?\]" outfile; then 40 : 41else 42 echo "Not OK (async resolve)" 43 exit 1 44fi 45if grep "Ratelimit-fg-on: pass" outfile; then 46 : 47else 48 echo "Not OK (ratelimit-fg-on)" 49 exit 1 50fi 51if grep "Ratelimit-fg-off: \[.\?10.20.30.40.\?\]" outfile; then 52 : 53else 54 echo "Not OK (ratelimit-fg-off)" 55 exit 1 56fi 57if grep "Ratelimit-bg-on: pass" outfile; then 58 : 59else 60 echo "Not OK (ratelimit-bg-on)" 61 exit 1 62fi 63if grep "Ratelimit-bg-off: \[.\?10.20.30.40.\?\]" outfile; then 64 : 65else 66 echo "Not OK (ratelimit-bg-off)" 67 exit 1 68fi 69 70echo "OK" 71 72exit 0 73