From: Peter van Dijk Date: Fri, 5 Oct 2012 08:02:06 +0000 (+0000) Subject: allow tests to live in separate directory, to allow limited testing of specific backends X-Git-Tag: auth-3.2-rc1~128 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=53f6670753f7c3f1ad3fd2ebd805d5b0a2652332;p=thirdparty%2Fpdns.git allow tests to live in separate directory, to allow limited testing of specific backends git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2754 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/regression-tests/runtests b/regression-tests/runtests index e3835b6edf..8a137adeeb 100755 --- a/regression-tests/runtests +++ b/regression-tests/runtests @@ -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 diff --git a/regression-tests/start-test-stop b/regression-tests/start-test-stop index 8672843ec7..59a5fd534b 100755 --- a/regression-tests/start-test-stop +++ b/regression-tests/start-test-stop @@ -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 diff --git a/regression-tests/totar b/regression-tests/totar index b86dd6c6d4..8ea96f672b 100755 --- a/regression-tests/totar +++ b/regression-tests/totar @@ -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) diff --git a/regression-tests/toxml b/regression-tests/toxml index 5ca2866a69..07848f433b 100755 --- a/regression-tests/toxml +++ b/regression-tests/toxml @@ -2,10 +2,10 @@ getstdout () { - if [ -e "$t/stdout" ] + if [ -e "${testsdir}/$t/stdout" ] then echo ' ' - cat $t/stdout | sed -e 's/&/\&/g' -e 's/"/\"/g' -e "s/'/\\'/g" -e 's//\>/g' + cat ${testsdir}/$t/stdout | sed -e 's/&/\&/g' -e 's/"/\"/g' -e "s/'/\\'/g" -e 's//\>/g' echo ' ' fi } @@ -20,7 +20,7 @@ for t in $(cat failed_tests) do echo ' ' echo ' ' - [ -e $t/diff ] && cat $t/diff | sed -e 's/&/\&/g' -e 's/"/\"/g' -e "s/'/\\'/g" -e 's//\>/g' + [ -e ${testsdir}/$t/diff ] && cat ${testsdir}/$t/diff | sed -e 's/&/\&/g' -e 's/"/\"/g' -e "s/'/\\'/g" -e 's//\>/g' echo ' ' getstdout echo ' '