unbound/testdata/pylib.tdir/pylib.test
Wouter Wijngaards 5853f90076 - With ./configure --with-pyunbound --with-pythonmodule
PYTHON_VERSION=3.6 or with 2.7 unbound can compile and unit tests
  succeed for the python module.
- pythonmod logs the python error and traceback on failure.


git-svn-id: file:///svn/unbound/trunk@4966 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-11-22 13:01:29 +00:00

73 lines
1.6 KiB
Plaintext

# #-- pylib.test --#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test
PRE="../.."
if grep "define WITH_PYUNBOUND 1" $PRE/config.h; then
echo "have pyunbound"
else
echo "no pyunbound"
exit 0
fi
if test "`uname 2>&1`" = "Darwin"; then
echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:../../.libs"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:../../.libs"
fi
#echo export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../../.libs:."
#export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../../.libs:."
if grep "PY_MAJOR_VERSION=3" $PRE/Makefile; then
PYTHON="python3"; else PYTHON="python2"; fi
if test ! -x `which $PYTHON` 2>&1; then PYTHON="python"; fi
# do the test
echo "> pylib.lookup.py www.example.com."
$PYTHON pylib.lookup.py www.example.com. | tee outfile
echo "> cat logfiles"
cat fwd.log
echo "> check answer"
if grep "Resolve: \[.\?10.20.30.40.\?\]" outfile; then
:
else
echo "Not OK (resolve)"
exit 1
fi
if grep "Async resolve: \[.\?10.20.30.40.\?\]" outfile; then
:
else
echo "Not OK (async resolve)"
exit 1
fi
if grep "Ratelimit-fg-on: pass" outfile; then
:
else
echo "Not OK (ratelimit-fg-on)"
exit 1
fi
if grep "Ratelimit-fg-off: \[.\?10.20.30.40.\?\]" outfile; then
:
else
echo "Not OK (ratelimit-fg-off)"
exit 1
fi
if grep "Ratelimit-bg-on: pass" outfile; then
:
else
echo "Not OK (ratelimit-bg-on)"
exit 1
fi
if grep "Ratelimit-bg-off: \[.\?10.20.30.40.\?\]" outfile; then
:
else
echo "Not OK (ratelimit-bg-off)"
exit 1
fi
echo "OK"
exit 0