Make test command.

git-svn-id: file:///svn/unbound/trunk@635 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-09-24 08:04:05 +00:00
parent 931efbbaa0
commit 2a5bcffcc2
6 changed files with 134 additions and 3 deletions

View file

@ -90,9 +90,14 @@ $(BUILD)%.o: $(srcdir)/%.c
@if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi @if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
$Q$(COMPILE) -c $< -o $@ $Q$(COMPILE) -c $< -o $@
.PHONY: clean realclean doc lint all install uninstall .PHONY: clean realclean doc lint all install uninstall tests test
all: $(COMMON_OBJ) unbound unittest testbound lock-verify pktview signit memstats all: $(COMMON_OBJ) unbound
tests: unittest testbound lock-verify pktview signit memstats
test: tests
bash testcode/do-tests.sh
unbound: $(DAEMON_OBJ) unbound: $(DAEMON_OBJ)
$(INFO) Link $@ $(INFO) Link $@

View file

@ -1,3 +1,7 @@
24 September 2007: Wouter
- do not make test programs by default.
- But 'make test' will perform all of the tests.
21 September 2007: Wouter 21 September 2007: Wouter
- fixup empty_DS_name allocated in wrong region (port DEC Alpha). - fixup empty_DS_name allocated in wrong region (port DEC Alpha).
- fixup testcode lock safety (port FreeBSD). - fixup testcode lock safety (port FreeBSD).

View file

@ -37,6 +37,9 @@ This software is under BSD license, see LICENSE for details.
the amount of memory it thinks it should be using, and reports the amount of memory it thinks it should be using, and reports
memory usage in detail. memory usage in detail.
* 'make test' attempts to run a series of tests, depending on the support
programs that are installed.
Known issues Known issues
------------ ------------
o If libevent is older (before 1.3c), unbound will exit instead of reload o If libevent is older (before 1.3c), unbound will exit instead of reload

View file

@ -161,6 +161,7 @@ Styleguide:
linked list cleanup list. unit test on this. do not call region linked list cleanup list. unit test on this. do not call region
to avoid name-collision with nsd regions, 'regional'. to avoid name-collision with nsd regions, 'regional'.
* read root hints from file. * read root hints from file.
* failover to next server in 1 second, instead of 100 seconds on one server.
* failure to return answer, w. reason (donotq, noanswer servers, cannot * failure to return answer, w. reason (donotq, noanswer servers, cannot
find servers, validationfail w.classification, error), find servers, validationfail w.classification, error),
with threadno, starttime and endtime and qname/type/class, prime/qflags, with threadno, starttime and endtime and qname/type/class, prime/qflags,

View file

@ -2,8 +2,10 @@
NEED_SPLINT='00-lint.tpkg' NEED_SPLINT='00-lint.tpkg'
NEED_DOXYGEN='01-doc.tpkg' NEED_DOXYGEN='01-doc.tpkg'
NEED_LDNS_TESTNS='fwd_no_edns.tpkg fwd_tcp_tc.tpkg fwd_tcp.tpkg fwd_three_service.tpkg fwd_three.tpkg fwd_ttlexpire.tpkg fwd_udp.tpkg'
cd testdata; cd testdata;
sh ../testcode/mini_tpkg.sh clean
for test in `ls *.tpkg`; do for test in `ls *.tpkg`; do
SKIP=0 SKIP=0
if echo $NEED_SPLINT | grep $test >/dev/null; then if echo $NEED_SPLINT | grep $test >/dev/null; then
@ -16,10 +18,16 @@ for test in `ls *.tpkg`; do
SKIP=1; SKIP=1;
fi fi
fi fi
if echo $NEED_LDNS_TESTNS | grep $test >/dev/null; then
if test ! -x "`which ldns-testns`"; then
SKIP=1;
fi
fi
if test $SKIP -eq 0; then if test $SKIP -eq 0; then
echo $test echo $test
tpkg -a ../.. exe $test sh ../testcode/mini_tpkg.sh -a ../.. exe $test
else else
echo "skip $test" echo "skip $test"
fi fi
done done
sh ../testcode/mini_tpkg.sh report

110
testcode/mini_tpkg.sh Executable file
View file

@ -0,0 +1,110 @@
# tpkg that only exes the files.
args="../.."
if test "$1" = "-a"; then
args=$2
shift
shift
fi
if test "$1" = "clean"; then
echo "rm -f result.* .done* .tpkg.var.master .tpkg.var.test"
rm -f result.* .done* .tpkg.var.master .tpkg.var.test
exit 0
fi
if test "$1" = "fake"; then
echo "minitpkg fake $2"
echo "fake" > .done-`basename $2 .tpkg`
exit 0
fi
if test "$1" = "report" || test "$2" = "report"; then
echo "Minitpkg Report"
for result in result.*; do
name=`echo $result | sed -e 's/result\.//'`
if test -f ".done-$name"; then
if test "$1" != "-q"; then
echo "** PASSED ** : $name"
fi
else
echo "!! FAILED !! : $name"
fi
done
exit 0
fi
if test "$1" != 'exe'; then
# usage
echo "mini tpkg. Reduced functionality for old shells."
echo " tpkg exe <file>"
echo " tpkg fake <file>"
echo " tpkg clean"
echo " tpkg [-q] report"
exit 1
fi
shift
# do not execute if the disk is too full
DISKLIMIT=100000
avail=`df . | tail -1 | awk '{print $4}'`
if test "$avail" -lt "$DISKLIMIT"; then
echo "minitpkg: The disk is too full! Only $avail."
exit 1
fi
name=`basename $1 .tpkg`
dir=$name.$$
result=result.$name
done=.done-$name
success="no"
shell="bash"
# check already done
if test -f .done-$name; then
echo "minitpkg .done-$name exists. skip test."
exit 0
fi
# Extract
echo "minitpkg extract $1 to $dir"
mkdir $dir
gzip -cd $name.tpkg | (cd $dir; tar xf -)
cd $dir
mv $name.dir/* .
# EXE
echo "minitpkg exe $name"
echo "minitpkg exe $name" > $result
if test -f $name.pre; then
echo "minitpkg exe $name.pre"
echo "minitpkg exe $name.pre" >> $result
$shell $name.pre $args >> $result
if test $? -ne 0; then
echo "Warning: $name.pre did not exit successfully"
fi
fi
if test -f $name.test; then
echo "minitpkg exe $name.test"
echo "minitpkg exe $name.test" >> $result
$shell $name.test $args >>$result 2>&1
if test $? -ne 0; then
echo "$name: FAILED" >> $result
echo "$name: FAILED"
success="no"
else
echo "$name: PASSED" >> $result
echo "$name: PASSED" > ../.done-$name
echo "$name: PASSED"
success="yes"
fi
fi
if test -f $name.post; then
echo "minitpkg exe $name.post"
echo "minitpkg exe $name.post" >> $result
$shell $name.post $args >> $result
if test $? -ne 0; then
echo "Warning: $name.post did not exit successfully"
fi
fi
mv $result ..
cd ..
rm -rf $dir