xref: /netbsd-src/external/bsd/unbound/dist/testdata/pylib.tdir/pylib.test (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
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-bg-on: pass" outfile; then
46	:
47else
48	echo "Not OK (ratelimit-bg-on)"
49	exit 1
50fi
51
52echo "OK"
53
54exit 0
55