unbound/testdata/tcp_reuse.tdir/tcp_reuse.test

66 lines
1.4 KiB
Text
Raw Normal View History

2020-06-03 04:01:51 -04:00
# #-- tcp_reuse.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="../.."
. ../common.sh
get_make
(cd $PRE; $MAKE streamtcp)
echo "> query www1.example.com."
$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www1.example.com. A IN >outfile 2>&1
cat outfile
if test "$?" -ne 0; then
echo "exit status not OK"
echo "> cat logfiles"
cat outfile
cat unbound2.log
cat unbound.log
echo "Not OK"
exit 1
fi
if grep "www1.example.com" outfile | grep "10.20.30.41"; then
echo "content OK"
else
echo "result contents not OK"
echo "> cat logfiles"
cat outfile
cat unbound2.log
cat unbound.log
echo "result contents not OK"
exit 1
fi
echo "OK"
echo ""
# this should be reused on the same tcp stream:
echo "> query www2.example.com."
$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www2.example.com. A IN >outfile 2>&1
cat outfile
if test "$?" -ne 0; then
echo "exit status not OK"
echo "> cat logfiles"
cat outfile
cat unbound2.log
cat unbound.log
echo "Not OK"
exit 1
fi
if grep "www2.example.com" outfile | grep "10.20.30.42"; then
echo "content OK"
else
echo "result contents not OK"
echo "> cat logfiles"
cat outfile
cat unbound2.log
cat unbound.log
echo "result contents not OK"
exit 1
fi
echo "OK"
exit 0