2 if [ -z "$testsdir" ]; then
3 echo "Incorrect usage. You probably want ./start-test-stop help"
10 export PDNS
=${PDNS:-${PWD}/../pdns/pdns_server}
11 export PDNS2
=${PDNS2:-${PWD}/../pdns/pdns_server}
12 export PDNSRECURSOR
=${PDNSRECURSOR:-${PWD}/../pdns/recursordist/pdns_recursor}
13 export RECCONTROL
=${RECCONTROL:-${PWD}/../pdns/recursordist/rec_control}
14 export SDIG
=${SDIG:-${PWD}/../pdns/sdig}
15 export NOTIFY
=${NOTIFY:-${PWD}/../pdns/pdns_notify}
16 export NSEC3DIG
=${NSEC3DIG:-${PWD}/../pdns/nsec3dig}
17 export SAXFR
=${SAXFR:-${PWD}/../pdns/saxfr}
18 export ZONE2SQL
=${ZONE2SQL:-${PWD}/../pdns/zone2sql}
19 export ZONE2JSON
=${ZONE2JSON:-${PWD}/../pdns/zone2json}
20 export ZONE2LDAP
=${ZONE2LDAP:-${PWD}/../pdns/zone2ldap}
21 export PDNSUTIL
=${PDNSUTIL:-${PWD}/../pdns/pdnsutil}
22 export PDNSCONTROL
=${PDNSCONTROL:-${PWD}/../pdns/pdns_control}
27 [ -z $spectest ] && spectest
=""
29 for prog
in $SDIG $SAXFR $NOTIFY $NSEC3DIG; do
30 if `echo $prog | grep -q '\.\./pdns'`; then
31 ${MAKE} -C ..
/pdns
${prog##*../pdns/} ||
exit
35 export SDIG
="timeout 5 $SDIG"
36 export NSEC3DIG
="timeout 5 $NSEC3DIG"
37 export SAXFR
="timeout 30 $SAXFR"
38 export PDNSCONTROL
="timeout 5 $PDNSCONTROL"
40 rm -f test-results failed_tests passed_tests skipped_tests
${testsdir}/*/real_result ${testsdir}/*/diff ${testsdir}/*/*.out ${testsdir}/*/start ${testsdir}/*/step.
*
46 touch passed_tests failed_tests skipped_tests
48 for a
in $
(find $testsdir -type d |
grep -v ^.$ |
grep -v .svn |
grep -v ^confdir | LC_ALL
=C
sort)
50 if [ ! -x $a/command ]
54 testname
=$
(basename $a)
57 if [ "${PDNS_DEBUG}" = "YES" ]; then
61 echo "$testname: " >> test-results
62 cat $a/description
>> test-results
68 result
=" Skipped test $a"
70 for reason
in $skipreasons $context $backend
72 if [ -e $a/skip.
$reason ]
75 result
=" Skipped test $a for reason $reason"
82 for reason
in $skipreasons $context $backend
84 if [ -e $a/fail.
$reason ]
91 if [ "$spectest" != "" ] && [ "$spectest" != "$testname" ] && [ "$testname" != "00dnssec-grabkeys" ]
94 result
=" Skipped test $a because it's not the specified single test"
100 echo $testname >> skipped_tests
101 skipped
=$
[$skipped+1]
103 $a/command > $a/real_result
104 expected
=$a/expected_result
107 if [ -e $a/expected_result.i
]; then
108 expected
=$a/expected_result.i
109 diffopts
="${diffopts} -i"
112 for extracontext
in $extracontexts
114 [ -e "$a/expected_result.$extracontext" ] && expected
=$a/expected_result.
$extracontext
116 [ -n "$context" ] && [ -e "$a/expected_result.$context" ] && expected
=$a/expected_result.
$context
117 diff ${diffopts} $expected $a/real_result
> $a/diff 2>&1
122 result
=" Failed test $a"
123 echo $testname >> failed_tests
125 if [ "$FIX_TESTS" == "YES" ]
127 mv -f $a/real_result
$expected
128 result
="$result (fixed)"
131 result
=" Expected failure for reason $reason, test passed $a"
132 echo $testname >> passed_tests
138 result
=" Passed test $a"
139 echo $testname >> passed_tests
142 result
=" Unexpected pass for reason $reason, test failed $a"
143 echo $testname >> failed_tests
150 echo "$result" >> test-results
154 if [ $failed -gt 0 ]; then
155 echo -n "::error title=Regression-tests::Tests failed. "
157 echo -n $passed out of $
[$passed+$failed]
159 res
=$
((echo scale
=2; echo 100*$passed/\
($passed+$failed\
)) |
bc )
161 echo tests passed
, $skipped were skipped