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
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
if [ $SKIPIT = 1 ]
then
- echo $a >> skipped_tests
+ echo $testname >> skipped_tests
skipped=$[$skipped+1]
else
$a/command > /dev/null
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
[ -z "$context" ] && context=bind-dnssec
wait=$3
+testsdir=.
+
if [ "$port" = help ] || [ "$context" = help ]
then
set +x
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
--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
export context
export extracontexts
export skipreasons
+export testsdir
if [ $presigned = yes ] && [ ${context:0:6} = gmysql ]
then
[ -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)
getstdout ()
{
- if [ -e "$t/stdout" ]
+ if [ -e "${testsdir}/$t/stdout" ]
then
echo ' <system-out>'
- cat $t/stdout | sed -e 's/&/\&/g' -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' -e 's/>/\>/g'
echo ' </system-out>'
fi
}
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/&/\&/g' -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' -e 's/>/\>/g'
echo ' </error>'
getstdout
echo ' </testcase>'