]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Make test command.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 24 Sep 2007 08:04:05 +0000 (08:04 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 24 Sep 2007 08:04:05 +0000 (08:04 +0000)
git-svn-id: file:///svn/unbound/trunk@635 be551aaa-1e26-0410-a405-d3ace91eadb9

Makefile.in
doc/Changelog
doc/README
doc/plan
testcode/do-tests.sh
testcode/mini_tpkg.sh [new file with mode: 0755]

index 3cf9dc8377cd4fa04f786031258cb1b61aed77c2..64ed245c805370a4731785e51311af3609c58b51 100644 (file)
@@ -90,9 +90,14 @@ $(BUILD)%.o:    $(srcdir)/%.c
        @if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
        $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)
        $(INFO) Link $@
index 737e95e66abb7c40f192227eeef134cbaa1359be..c14385e8d1935bf6314920c48dae82e18551fa19 100644 (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
        - fixup empty_DS_name allocated in wrong region (port DEC Alpha).
        - fixup testcode lock safety (port FreeBSD).
index af05c88b0ee25bac52029cbaef614adad6f17091..85ba0fccaffc3f68639af34ca9b13ec624206f9b 100644 (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 
        memory usage in detail.
 
+* 'make test' attempts to run a series of tests, depending on the support
+  programs that are installed.
+
 Known issues
 ------------
 o If libevent is older (before 1.3c), unbound will exit instead of reload
index 57d533473781467bedb01ea8211ae79cb53436ee..709b70236a0659146e1bdad344b4f760dcf2f183 100644 (file)
--- a/doc/plan
+++ b/doc/plan
@@ -161,6 +161,7 @@ Styleguide:
          linked list cleanup list. unit test on this. do not call region
          to avoid name-collision with nsd regions, 'regional'.
 * 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
   find servers, validationfail w.classification, error), 
   with threadno, starttime and endtime and qname/type/class, prime/qflags, 
index b1fcd040db8632b2be8366c8c58db25c8ea5f786..2685caea18fc83bace3baa608847c2b9ea966b04 100755 (executable)
@@ -2,8 +2,10 @@
 
 NEED_SPLINT='00-lint.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;
+sh ../testcode/mini_tpkg.sh clean
 for test in `ls *.tpkg`; do
        SKIP=0
        if echo $NEED_SPLINT | grep $test >/dev/null; then
@@ -16,10 +18,16 @@ for test in `ls *.tpkg`; do
                        SKIP=1;
                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
                echo $test
-               tpkg -a ../.. exe $test
+               sh ../testcode/mini_tpkg.sh -a ../.. exe $test
        else
                echo "skip $test"
        fi
 done
+sh ../testcode/mini_tpkg.sh report
diff --git a/testcode/mini_tpkg.sh b/testcode/mini_tpkg.sh
new file mode 100755 (executable)
index 0000000..283581f
--- /dev/null
@@ -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