Unit test maintenance, to:

- remove obsolete tests
- test better for parallel installs
- run custom servers through valgrind
This commit is contained in:
Willem Toorop 2018-02-22 14:44:13 +01:00
parent 21155d5aa9
commit 65e610f26e
29 changed files with 62 additions and 108 deletions

View File

@ -25,4 +25,4 @@ done
rm -fr "${BUILDDIR}/build" rm -fr "${BUILDDIR}/build"
mkdir "${BUILDDIR}/build" mkdir "${BUILDDIR}/build"
cd "${BUILDDIR}/build" cd "${BUILDDIR}/build"
"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-debug-anchor "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install"

View File

@ -5,4 +5,4 @@
[ -f .tpkg.var.test ] && source .tpkg.var.test [ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build" cd "${BUILDDIR}/build"
make XTRA_CFLAGS='-Werror' -j 4 make XTRA_CFLAGS='-g -Werror' -j 4

View File

@ -5,4 +5,6 @@
[ -f .tpkg.var.test ] && source .tpkg.var.test [ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build" cd "${BUILDDIR}/build"
make -j 4 install make -j 4 install \
&& echo "export GETDNS_QUERY=\"${BUILDDIR}/build/src/tools/getdns_query\"" \
>> ../.tpkg.var.master

View File

@ -1,16 +0,0 @@
BaseName: 110-link
Version: 1.0
Description: Link getdns_query program
CreationDate: do dec 10 11:10:11 CET 2015
Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 100-compile.tpkg
Help:
Pre:
Post:
Test: 110-link.test
AuxFiles:
Passed:
Failure:

View File

@ -1,10 +0,0 @@
# #-- 110-link.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
cd "${BUILDDIR}/build"
make -j 4 getdns_query \
&& echo "export GETDNS_QUERY=\"${BUILDDIR}/build/src/tools/getdns_query\"" \
>> ../.tpkg.var.master

View File

@ -1,16 +0,0 @@
BaseName: 115-install-linked
Version: 1.0
Description: Install the getdns_query program
CreationDate: vr dec 18 10:52:26 CET 2015
Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 110-link.tpkg
Help:
Pre:
Post:
Test: 115-install-linked.test
AuxFiles:
Passed:
Failure:

View File

@ -1,8 +0,0 @@
# #-- 115-install-linked.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
cd "${BUILDDIR}/build"
make -j 4 install-getdns_query

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category: Category:
Component: Component:
CmdDepends: CmdDepends:
Depends: 110-link.tpkg Depends: 105-install.tpkg
Help: Help:
Pre: Pre:
Post: Post:

View File

@ -1 +1,2 @@
. DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5 . DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5
. DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category: Category:
Component: Component:
CmdDepends: valgrind CmdDepends: valgrind
Depends: 110-link.tpkg Depends: 105-install.tpkg
Help: Help:
Pre: Pre:
Post: Post:

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category: Category:
Component: Component:
CmdDepends: CmdDepends:
Depends: 110-link.tpkg Depends: 105-install.tpkg
Help: Help:
Pre: Pre:
Post: Post:

View File

@ -1,4 +1,4 @@
BaseName: 200-stub-only-compile BaseName: 200-stub-only-compile-install
Version: 1.0 Version: 1.0
Description: Create builddir and compile stub only Description: Create builddir and compile stub only
CreationDate: do dec 10 11:08:24 CET 2015 CreationDate: do dec 10 11:08:24 CET 2015
@ -8,9 +8,9 @@ Component:
CmdDepends: CmdDepends:
Depends: Depends:
Help: Help:
Pre: 200-stub-only-compile.pre Pre: 200-stub-only-compile-install.pre
Post: 200-stub-only-compile.post Post: 200-stub-only-compile-install.post
Test: 200-stub-only-compile.test Test: 200-stub-only-compile-install.test
AuxFiles: AuxFiles:
Passed: Passed:
Failure: Failure:

View File

@ -25,4 +25,4 @@ done
rm -fr "${BUILDDIR}/build-stub-only" rm -fr "${BUILDDIR}/build-stub-only"
mkdir "${BUILDDIR}/build-stub-only" mkdir "${BUILDDIR}/build-stub-only"
cd "${BUILDDIR}/build-stub-only" cd "${BUILDDIR}/build-stub-only"
"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install-stub-only" --enable-stub-only "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install-stub-only" --enable-stub-only --enable-debug-server --enable-debug-anchor

View File

@ -5,4 +5,6 @@
[ -f .tpkg.var.test ] && source .tpkg.var.test [ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build-stub-only" cd "${BUILDDIR}/build-stub-only"
make XTRA_CFLAGS='-Werror' -j 4 make XTRA_CFLAGS='-g -Werror' -j 4 install \
&& echo "export GETDNS_STUB_QUERY=\"${BUILDDIR}/build-stub-only/src/tools/getdns_query\"" \
>> ../.tpkg.var.master

View File

@ -1,16 +0,0 @@
BaseName: 210-stub-only-link
Version: 1.0
Description: Link getdns_query program
CreationDate: do dec 10 11:08:37 CET 2015
Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 200-stub-only-compile.tpkg
Help:
Pre:
Post:
Test: 210-stub-only-link.test
AuxFiles:
Passed:
Failure:

View File

@ -1,10 +0,0 @@
# #-- 210-stub-only-link.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
cd "${BUILDDIR}/build-stub-only"
make -j 4 getdns_query \
&& echo "export GETDNS_STUB_QUERY=\"${BUILDDIR}/build-stub-only/src/tools/getdns_query\"" \
>> ../.tpkg.var.master

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category: Category:
Component: Component:
CmdDepends: CmdDepends:
Depends: 210-stub-only-link.tpkg Depends: 200-stub-only-compile-install.tpkg
Help: Help:
Pre: Pre:
Post: Post:

View File

@ -1 +0,0 @@
. DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5

View File

@ -1,12 +1,12 @@
BaseName: 225-stub-only-valgrind-checks BaseName: 225-stub-only-valgrind-checks
Version: 1.0 Version: 1.0
Description: Run valgrind to detect memory leaks Description: Run getdns_query in valgrind + Zero configuration DNSSEC test
CreationDate: ma mrt 21 16:24:56 CET 2016 CreationDate: ma mrt 21 16:24:56 CET 2016
Maintainer: Willem Toorop Maintainer: Willem Toorop
Category: Category:
Component: Component:
CmdDepends: valgrind CmdDepends: valgrind
Depends: 210-stub-only-link.tpkg Depends: 200-stub-only-compile-install.tpkg
Help: Help:
Pre: Pre:
Post: Post:

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category: Category:
Component: Component:
CmdDepends: CmdDepends:
Depends: 210-stub-only-link.tpkg Depends: 200-stub-only-compile-install.tpkg
Help: Help:
Pre: Pre:
Post: Post:

View File

@ -6,7 +6,7 @@ Maintainer: Hoda Rohani
Category: Category:
Component: Component:
CmdDepends: CmdDepends:
Depends: 210-stub-only-link.tpkg Depends: 200-stub-only-compile-install.tpkg
Help: Help:
Pre: 275-server-capabilities.pre Pre: 275-server-capabilities.pre
Post: Post:

View File

@ -21,10 +21,14 @@ make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgri
${GETDNS_STUB_QUERY} -s -q @${LOCALHOST}:$PORT TXT quit. ${GETDNS_STUB_QUERY} -s -q @${LOCALHOST}:$PORT TXT quit.
) )
if grep -q 'definitely lost: [^0]' valgrind.log if ! awk '/^==.*(definitely|indirectly|possibly) lost/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
exit 1
fi
if ! awk '/^==.* ERROR SUMMARY/{print;if($4>0)exit(1)}' valgrind.log
then then
cat valgrind.log cat valgrind.log
echo "error: Memory loss!"
exit 1 exit 1
fi fi
if ! grep -q '"status": GETDNS_RESPSTATUS_ALL_TIMEOUT' time_out if ! grep -q '"status": GETDNS_RESPSTATUS_ALL_TIMEOUT' time_out

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category: Resource depletion Category: Resource depletion
Component: Component:
CmdDepends: CmdDepends:
Depends: 210-stub-only-link.tpkg Depends: 200-stub-only-compile-install.tpkg
Help: Help:
Pre: 280-limit_outstanding_queries.pre Pre: 280-limit_outstanding_queries.pre
Post: Post:

View File

@ -19,13 +19,13 @@ echo "# queries: $NQUERIES"
# which is smaller than 5 seconds default query timeout value, # which is smaller than 5 seconds default query timeout value,
# so the test should succeed. # so the test should succeed.
make && "./${TPKG_NAME}" ${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 PORT
${GETDNS_STUB_QUERY} @${LOCALHOST}:$PORT TXT \ ${GETDNS_STUB_QUERY} -s @${LOCALHOST}:$PORT TXT \
-a -F "./${TPKG_NAME}.queries" \ -a -F "./${TPKG_NAME}.queries" \
"{limit_outstanding_queries:$QLIMIT}" 2>&1 > out "{limit_outstanding_queries:$QLIMIT}" 2>&1 > out
${GETDNS_STUB_QUERY} -q @${LOCALHOST}:$PORT TXT quit. ${GETDNS_STUB_QUERY} -s -q @${LOCALHOST}:$PORT TXT quit.
) && grep '"n_requests: [0-9][0-9]*"' out | sed -e 's/^.*n_requests: //g' -e 's/".*$//g' \ ) && grep '"n_requests: [0-9][0-9]*"' out | sed -e 's/^.*n_requests: //g' -e 's/".*$//g' \
| awk -vQLIMIT=$QLIMIT -vNQUERIES=$NQUERIES ' | awk -vQLIMIT=$QLIMIT -vNQUERIES=$NQUERIES '
@ -43,4 +43,15 @@ END{
exit(-1); exit(-1);
} else } else
print "SUCCESS: No more than "QLIMIT" outstanding queries: "max_outstanding; print "SUCCESS: No more than "QLIMIT" outstanding queries: "max_outstanding;
}' }' && (
if ! awk '/^==.*(definitely|indirectly|possibly) lost/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
exit 1
fi
if ! awk '/^==.* ERROR SUMMARY/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
exit 1
fi
)

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category: Resource depletion Category: Resource depletion
Component: Component:
CmdDepends: CmdDepends:
Depends: 210-stub-only-link.tpkg Depends: 200-stub-only-compile-install.tpkg
Help: Help:
Pre: 285-out_of_filedescriptors.pre Pre: 285-out_of_filedescriptors.pre
Post: Post:

View File

@ -27,13 +27,13 @@ echo "# queries: $NQUERIES"
# which is smaller than 5 seconds default query timeout value, # which is smaller than 5 seconds default query timeout value,
# so the test should succeed. # so the test should succeed.
make && "./${TPKG_NAME}" ${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 PORT
ulimit -n $QLIMIT ulimit -n $QLIMIT
${GETDNS_STUB_QUERY} @${LOCALHOST}:$PORT TXT \ ${GETDNS_STUB_QUERY} -s @${LOCALHOST}:$PORT TXT \
-a -F "./${TPKG_NAME}.queries" 2>&1 > out -a -F "./${TPKG_NAME}.queries" 2>&1 > out
${GETDNS_STUB_QUERY} -q @${LOCALHOST}:$PORT TXT quit. ${GETDNS_STUB_QUERY} -s -q @${LOCALHOST}:$PORT TXT quit.
) && grep '"n_requests: [0-9][0-9]*"' out | sed -e 's/^.*n_requests: //g' -e 's/".*$//g' \ ) && grep '"n_requests: [0-9][0-9]*"' out | sed -e 's/^.*n_requests: //g' -e 's/".*$//g' \
| awk -vQLIMIT=$QLIMIT -vNQUERIES=$NQUERIES ' | awk -vQLIMIT=$QLIMIT -vNQUERIES=$NQUERIES '
@ -51,4 +51,15 @@ END{
exit(-1); exit(-1);
} else } else
print "SUCCESS: No more than "QLIMIT" outstanding queries: "max_outstanding; print "SUCCESS: No more than "QLIMIT" outstanding queries: "max_outstanding;
}' }' && (
if ! awk '/^==.*(definitely|indirectly|possibly) lost/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
exit 1
fi
if ! awk '/^==.* ERROR SUMMARY/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
exit 1
fi
)

View File

@ -6,7 +6,7 @@ Maintainer: Hoda Rohani
Category: Category:
Component: Component:
CmdDepends: CmdDepends:
Depends: 210-stub-only-link.tpkg Depends: 200-stub-only-compile-install.tpkg
Help: Help:
Pre: Pre:
Post: Post:

View File

@ -5,4 +5,4 @@
[ -f .tpkg.var.test ] && source .tpkg.var.test [ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build-event-loops" cd "${BUILDDIR}/build-event-loops"
make XTRA_CFLAGS=-Werror -j 4 make XTRA_CFLAGS="-g -Werror" -j 4 install