mirror of https://github.com/getdnsapi/getdns.git
56 lines
1.6 KiB
Plaintext
56 lines
1.6 KiB
Plaintext
# #-- 275-server-capabilities.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
|
|
|
|
LOCALHOST=`${GETDNS_STUB_QUERY} '{namespaces:[GETDNS_NAMESPACE_LOCALNAMES]}' -A localhost. -J \
|
|
| awk -F: '/\"address_data\".*\"127/{print $2}' \
|
|
| sed -e 's/^[^"]*"//g' -e 's/"[^"]*$//g'`
|
|
echo "localhost: $LOCALHOST"
|
|
|
|
make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST} | (
|
|
read PORT
|
|
read PORT2
|
|
|
|
${GETDNS_STUB_QUERY} -s -t 1000 @${LOCALHOST}:$PORT TXT cancel. +return_call_reporting 2>&1 > time_out
|
|
|
|
${GETDNS_STUB_QUERY} -s @${LOCALHOST}:$PORT TXT test +return_call_reporting 2>&1 > tcp_out
|
|
|
|
${GETDNS_STUB_QUERY} -s -U @${LOCALHOST}:$PORT2 TXT test +return_call_reporting 2>&1 > udp_out
|
|
|
|
${GETDNS_STUB_QUERY} -s -q @${LOCALHOST}:$PORT TXT quit.
|
|
)
|
|
if grep -q 'definitely lost: [^0]' valgrind.log
|
|
then
|
|
cat valgrind.log
|
|
echo "error: Memory loss!"
|
|
exit 1
|
|
fi
|
|
if ! grep -q '"status": GETDNS_RESPSTATUS_ALL_TIMEOUT' time_out
|
|
then
|
|
cat time_out
|
|
echo 'error: Query was answered (i think)!'
|
|
exit 1
|
|
|
|
elif ! grep -q '"transport": GETDNS_TRANSPORT_TCP' tcp_out
|
|
then
|
|
cat tcp_out
|
|
echo 'error: Query was not over TCP!'
|
|
exit 1
|
|
|
|
elif ! grep -q '"transport": GETDNS_TRANSPORT_UDP' udp_out
|
|
then
|
|
cat udp_out
|
|
echo 'error: Query was not over UDP!'
|
|
exit 1
|
|
|
|
elif ! grep -q '"Some answer"' tcp_out
|
|
then
|
|
cat tcp_out
|
|
echo 'error: Query was not answered!'
|
|
exit 1
|
|
else
|
|
exit 0
|
|
fi
|