10cd9f4ecSchristos# #-- pylib.test --# 20cd9f4ecSchristos# source the master var file when it's there 30cd9f4ecSchristos[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master 40cd9f4ecSchristos# use .tpkg.var.test for in test variable passing 50cd9f4ecSchristos[ -f .tpkg.var.test ] && source .tpkg.var.test 60cd9f4ecSchristos 70cd9f4ecSchristosPRE="../.." 80cd9f4ecSchristosif test "`uname 2>&1`" = "Darwin"; then 90cd9f4ecSchristos echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:../../.libs" 100cd9f4ecSchristos export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:../../.libs" 110cd9f4ecSchristosfi 120cd9f4ecSchristos#echo export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../../.libs:." 130cd9f4ecSchristos#export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../../.libs:." 140cd9f4ecSchristos 15*f42d8de7Schristosif grep "PY_MAJOR_VERSION=3" $PRE/Makefile; then 16*f42d8de7Schristos PYTHON="python3"; else PYTHON="python2"; fi 17*f42d8de7Schristosif test ! -x `which $PYTHON` 2>&1; then PYTHON="python"; fi 180cd9f4ecSchristos 190cd9f4ecSchristos# do the test 200cd9f4ecSchristosecho "> pylib.lookup.py www.example.com." 21*f42d8de7Schristos$PYTHON pylib.lookup.py www.example.com. | tee outfile 220cd9f4ecSchristos 230cd9f4ecSchristosecho "> cat logfiles" 240cd9f4ecSchristoscat fwd.log 250cd9f4ecSchristosecho "> check answer" 26*f42d8de7Schristosif grep "Resolve: \[.\?10.20.30.40.\?\]" outfile; then 27*f42d8de7Schristos : 280cd9f4ecSchristoselse 29*f42d8de7Schristos echo "Not OK (resolve)" 300cd9f4ecSchristos exit 1 310cd9f4ecSchristosfi 32*f42d8de7Schristosif grep "Async resolve: \[.\?10.20.30.40.\?\]" outfile; then 33*f42d8de7Schristos : 34*f42d8de7Schristoselse 35*f42d8de7Schristos echo "Not OK (async resolve)" 36*f42d8de7Schristos exit 1 37*f42d8de7Schristosfi 38*f42d8de7Schristosif grep "Ratelimit-bg-on: pass" outfile; then 39*f42d8de7Schristos : 40*f42d8de7Schristoselse 41*f42d8de7Schristos echo "Not OK (ratelimit-bg-on)" 42*f42d8de7Schristos exit 1 43*f42d8de7Schristosfi 44*f42d8de7Schristos 45*f42d8de7Schristosecho "OK" 460cd9f4ecSchristos 470cd9f4ecSchristosexit 0 48