1 # #-- dynlibmod.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
9 if grep "define WITH_DYNLIBMODULE 1" $PRE/config.h; then echo test enabled; else echo test skipped; exit 0; fi
11 # compile the dynamic library module
12 if grep "define USE_WINSOCK 1" $PRE/config.h; then
13 echo "compile dynamic library dll for mingw"
14 echo "x86_64-w64-mingw32-gcc -m64 -I$PRE -shared -Wall -fpic -o helloworld.dll $PRE/dynlibmod/examples/helloworld.c -L../.. -l:libunbound.a"
15 x86_64-w64-mingw32-gcc -m64 -I$PRE -shared -Wall -fpic -o helloworld.dll $PRE/dynlibmod/examples/helloworld.c -L../.. -l:libunbound.a
17 echo "compile failure"
21 echo "compile dynamic library"
22 echo "gcc -I$PRE -shared -Wall -fpic -o helloworld.so $PRE/dynlibmod/examples/helloworld.c"
23 gcc -I$PRE -shared -Wall -fpic -o helloworld.so $PRE/dynlibmod/examples/helloworld.c
25 echo "compile failure"
30 # start unbound in the background
31 LD_LIBRARY_PATH="." $PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
33 echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
34 wait_unbound_up unbound.log
36 # test if the server is up.
37 echo "> dig www.example.com."
38 dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. | tee outfile
40 if grep "10.20.30.40" outfile; then
50 echo "> check log for dynlibmod info"
51 # wait for a moment for filesystem to catch up.
52 if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
53 if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
54 if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
55 if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
56 if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
57 if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
58 if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 10; fi
59 if grep "hello world from operate" unbound.log; then echo "yes it is in unbound.log";
61 echo "information not in unbound.log"