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 test "`uname 2>&1`" = "Darwin"; then 9 echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:../../.libs" 10 export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:../../.libs" 11fi 12#echo export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../../.libs:." 13#export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../../.libs:." 14 15if grep "PY_MAJOR_VERSION=3" $PRE/Makefile; then 16 PYTHON="python3"; else PYTHON="python2"; fi 17if test ! -x `which $PYTHON` 2>&1; then PYTHON="python"; fi 18 19# do the test 20echo "> pylib.lookup.py www.example.com." 21$PYTHON pylib.lookup.py www.example.com. | tee outfile 22 23echo "> cat logfiles" 24cat fwd.log 25echo "> check answer" 26if grep "Resolve: \[.\?10.20.30.40.\?\]" outfile; then 27 : 28else 29 echo "Not OK (resolve)" 30 exit 1 31fi 32if grep "Async resolve: \[.\?10.20.30.40.\?\]" outfile; then 33 : 34else 35 echo "Not OK (async resolve)" 36 exit 1 37fi 38if grep "Ratelimit-bg-on: pass" outfile; then 39 : 40else 41 echo "Not OK (ratelimit-bg-on)" 42 exit 1 43fi 44 45echo "OK" 46 47exit 0 48