]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
allow tests to live in separate directory, to allow limited testing of specific backends
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Fri, 5 Oct 2012 08:02:06 +0000 (08:02 +0000)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Fri, 5 Oct 2012 08:02:06 +0000 (08:02 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2754 d19b8d6e-7fed-0310-83ef-9ca221ded41b

regression-tests/runtests
regression-tests/start-test-stop
regression-tests/totar
regression-tests/toxml

index e3835b6edf104fe6d59bb21776beffbcf04b1b9d..8a137adeeba012f2816528909ec11d11936f07b5 100755 (executable)
@@ -3,7 +3,7 @@ PATH=.:$PATH
 
 make -C ../pdns sdig nsec3dig || exit 1
 
-rm -f test-results failed_tests passed_tests skipped_tests */real_result */diff */*.out
+rm -f test-results failed_tests passed_tests skipped_tests ${testsdir}/*/real_result ${testdir}/*/diff ${testdir}/*/*.out
 
 passed=0
 failed=0
@@ -11,18 +11,18 @@ skipped=0
 
 touch passed_tests failed_tests skipped_tests
 
-for a in $(find . -type d | grep -v ^.$ | sed s:^./:: | grep -v .svn | grep -v ^confdir | LC_ALL=C sort) 
+for a in $(find $testsdir -type d | grep -v ^.$ | grep -v .svn | grep -v ^confdir | LC_ALL=C sort) 
 do
        if [ ! -x $a/command ]
        then
                continue
        fi
-       testname=$a
+       testname=$(basename $a)
        export testname
-       echo  "$a: "
+       echo  "$testname: "
        cat $a/description 
 
-       echo  "$a: " >> test-results
+       echo  "$testname: " >> test-results
        cat $a/description >> test-results
        
        SKIPIT=0
@@ -44,7 +44,7 @@ do
                                
        if [ $SKIPIT = 1 ]
        then
-               echo $a >> skipped_tests
+               echo $testname >> skipped_tests
                skipped=$[$skipped+1]
        else    
                $a/command > /dev/null
@@ -59,11 +59,11 @@ do
                if [ -s $a/diff ] 
                then
                        result="        Failed test $a"
-                       echo $a >> failed_tests
+                       echo $testname >> failed_tests
                        failed=$[$failed+1]
                else
                        result="        Passed test $a"
-                       echo $a >> passed_tests
+                       echo $testname >> passed_tests
                        passed=$[$passed+1]
                fi
        fi      
index 8672843ec7dd276db76f775f16383054917b971a..59a5fd534baadd5babaf9e9690dcd3083d844b89 100755 (executable)
@@ -26,6 +26,8 @@ context=$2
 [ -z "$context" ] && context=bind-dnssec
 wait=$3
 
+testsdir=.
+
 if [ "$port" = help ] || [ "$context" = help ]
 then
        set +x
@@ -40,6 +42,8 @@ gpgsql-nodnssec gpgsql gpgsql-nsec3
 gsqlite3-nodnssec gsqlite3 gsqlite3-nsec3
 opendbx-sqlite3
 tinydns
+remotebackend-pipe remotebackend-unix remotebackend-http 
+remotebackend-pipe-dnssec remotebackend-unix-dnssec remotebackend-http-dnssec
 
 add -presigned to any gmysql test (except narrow) to test 
 presigned operation
@@ -346,6 +350,50 @@ __EOF__
                                --send-root-referral \
                                --tinydns-dbfile=../modules/tinydnsbackend/data.cdb & 
                        skipreasons="nodnssec noent"
+                       ;;
+               remotebackend-*)
+                       remotetype=$(echo $context | cut -d- -f 2)
+                       remotesec=$(echo $context | cut -d- -f 3)
+
+                       case $remotetype in
+                       http)
+                               connstr="http:url=http://localhost:62434/dns"
+                               ../modules/remotebackend/regression-tests/http-backend.rb &
+                               echo $! > pdns-remotebackend.pid
+                               ;;
+                       unix)
+                               connstr="unix:path=/tmp/remote.socket"
+                               socat unix-listen:/tmp/remote.socket exec:../modules/remotebackend/regression-tests/pipe-backend.rb &
+                               echo $! > pdns-remotebackend.pid
+                               ;;
+                       pipe)
+                               connstr="pipe:command=../modules/remotebackend/regression-tests/pipe-backend.rb"
+                               ;;
+                       *)
+                               echo "Invalid usage"
+                               exit 1
+                               ;;
+                       esac
+
+                       if [ "$remotesec" = "dnssec" ]; then
+                               remote_add_param="--remote-dnssec=yes"
+                       fi
+
+                       $RUNWRAPPER ../pdns/pdns_server --daemon=no --local-port=$port --socket-dir=./ \
+                               --no-shuffle --launch=remote \
+                               --query-logging --loglevel=9 --cache-ttl=0 --no-config \
+                               --send-root-referral \
+                               --remote-connection-string="$connstr" $remote_add_param &
+                        
+                       if [ "$remotesec" = "dnssec" ]
+                       then
+                               extracontexts="dnssec"
+                       else
+                               skipreasons="nodnssec"
+                       fi
+
+                       testsdir=../modules/remotebackend/regression-tests/
+
                        ;;
                *)
                        echo unknown context $context
@@ -359,6 +407,7 @@ export port
 export context
 export extracontexts
 export skipreasons
+export testsdir
 
 if [ $presigned = yes ] && [ ${context:0:6} = gmysql ]
 then
index b86dd6c6d4a34ff991847e7292f29ca2e03a2931..8ea96f672b47c36cbab6b74eced2d2898285e33a 100755 (executable)
@@ -2,4 +2,4 @@
 [ -z "$context" ] && context="global"
 
 # let ls sort our filenames
-tar cf testresults-${context}.tar $(ls */real_result */*.out testresults-${context}.xml)
+tar cf testresults-${context}.tar $(ls ${testsdir}/*/real_result ${testsdir}/*/*.out testresults-${context}.xml)
index 5ca2866a698f4eda44951e5f7dac5290fe6133db..07848f433b80de94f7321ad85906431449a3b642 100755 (executable)
@@ -2,10 +2,10 @@
 
 getstdout ()
 {
-       if [ -e "$t/stdout" ]
+       if [ -e "${testsdir}/$t/stdout" ]
        then
                echo '    <system-out>'
-                       cat $t/stdout | sed -e 's/&/\&amp;/g' -e 's/"/\&quot;/g' -e "s/'/\\&apos;/g" -e 's/</\&lt;/g' -e 's/>/\&gt;/g'
+                       cat ${testsdir}/$t/stdout | sed -e 's/&/\&amp;/g' -e 's/"/\&quot;/g' -e "s/'/\\&apos;/g" -e 's/</\&lt;/g' -e 's/>/\&gt;/g'
                echo '    </system-out>'
        fi
 }
@@ -20,7 +20,7 @@ for t in $(cat failed_tests)
 do
        echo '  <testcase name="'$t'" classname="'$context'" time="0">'
        echo '    <error type="error" message="test failed">'
-       [ -e $t/diff ] && cat $t/diff | sed -e 's/&/\&amp;/g' -e 's/"/\&quot;/g' -e "s/'/\\&apos;/g" -e 's/</\&lt;/g' -e 's/>/\&gt;/g'
+       [ -e ${testsdir}/$t/diff ] && cat ${testsdir}/$t/diff | sed -e 's/&/\&amp;/g' -e 's/"/\&quot;/g' -e "s/'/\\&apos;/g" -e 's/</\&lt;/g' -e 's/>/\&gt;/g'
        echo '    </error>'
        getstdout
        echo '  </testcase>'