]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - testdata/pylib.tdir/pylib.test
Vendor import of Unbound 1.9.0.
[FreeBSD/FreeBSD.git] / testdata / pylib.tdir / pylib.test
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
7 PRE="../.."
8 if grep "define WITH_PYUNBOUND 1" $PRE/config.h; then
9         echo "have pyunbound"
10 else
11         echo "no pyunbound"
12         exit 0
13 fi
14
15 if 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"
18 fi
19 #echo export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../../.libs:."
20 #export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../../.libs:."
21
22 if grep "PY_MAJOR_VERSION=3" $PRE/Makefile; then
23         PYTHON="python3"; else PYTHON="python2"; fi
24 if test ! -x `which $PYTHON` 2>&1; then PYTHON="python"; fi
25
26 # do the test
27 echo "> pylib.lookup.py www.example.com."
28 $PYTHON pylib.lookup.py www.example.com. | tee outfile
29
30 echo "> cat logfiles"
31 cat fwd.log
32 echo "> check answer"
33 if grep "Resolve: \[.\?10.20.30.40.\?\]" outfile; then
34         :
35 else
36         echo "Not OK (resolve)"
37         exit 1
38 fi
39 if grep "Async resolve: \[.\?10.20.30.40.\?\]" outfile; then
40         :
41 else
42         echo "Not OK (async resolve)"
43         exit 1
44 fi
45 if grep "Ratelimit-fg-on: pass" outfile; then
46         :
47 else
48         echo "Not OK (ratelimit-fg-on)"
49         exit 1
50 fi
51 if grep "Ratelimit-fg-off: \[.\?10.20.30.40.\?\]" outfile; then
52         :
53 else
54         echo "Not OK (ratelimit-fg-off)"
55         exit 1
56 fi
57 if grep "Ratelimit-bg-on: pass" outfile; then
58         :
59 else
60         echo "Not OK (ratelimit-bg-on)"
61         exit 1
62 fi
63 if grep "Ratelimit-bg-off: \[.\?10.20.30.40.\?\]" outfile; then
64         :
65 else
66         echo "Not OK (ratelimit-bg-off)"
67         exit 1
68 fi
69
70 echo "OK"
71
72 exit 0