3 if [ "${PDNS_DEBUG}" = "YES" ]; then
7 export PDNS
=${PDNS:-${PWD}/../pdns/pdns_server}
8 export PDNS2
=${PDNS2:-${PWD}/../pdns/pdns_server}
9 export PDNSRECURSOR
=${PDNSRECURSOR:-${PWD}/../pdns/recursordist/pdns_recursor}
10 export RECCONTROL
=${RECCONTROL:-${PWD}/../pdns/recursordist/rec_control}
11 export SDIG
=${SDIG:-${PWD}/../pdns/sdig}
12 export NOTIFY
=${NOTIFY:-${PWD}/../pdns/pdns_notify}
13 export NSEC3DIG
=${NSEC3DIG:-${PWD}/../pdns/nsec3dig}
14 export SAXFR
=${SAXFR:-${PWD}/../pdns/saxfr}
15 export ZONE2SQL
=${ZONE2SQL:-${PWD}/../pdns/zone2sql}
16 export ZONE2LDAP
=${ZONE2LDAP:-${PWD}/../pdns/zone2ldap}
17 export PDNSUTIL
=${PDNSUTIL:-${PWD}/../pdns/pdnsutil}
18 export PDNSCONTROL
=${PDNSCONTROL:-${PWD}/../pdns/pdns_control}
19 export RESOLVERIP
=${RESOLVERIP:-8.8.8.8}
20 export FIX_TESTS
=${FIX_TESTS:-NO}
23 ALGORITHM
=${ALGORITHM:="hmac-md5"}
24 KEY
=${KEY:="kp4/24gyYsEzbuTVJRUMoqGFmN3LYgVDzJ/3oRSP7ys="}
31 trap "kill_process 2" EXIT INT TERM
33 source ..
/regression-tests
/common
39 domcount
=$
(grep -c ^zone named.conf
)
40 if [ ! -x $PDNSCONTROL ]
42 echo "No pdns_control found"
47 while [ $loopcount -lt 20 ]
50 done=$
( ($PDNSCONTROL --config-name=$configname --socket-dir=.
--no-config bind-domain-status || true
) |
grep -c 'parsed into memory' || true
)
51 if [ $done = $domcount ]
55 let loopcount
=loopcount
+1
58 if [ $done != $domcount ]
60 echo "Domain parsing failed" >> failed_tests
69 if [ -n "$configname" ]
71 configname
="--config-name=$configname"
73 if [ "${zone: 0:16}" = "secure-delegated" ]
75 $PDNSUTIL --config-dir=.
$configname import-zone-key
$zone $zone.private ksk
2>&1
76 $PDNSUTIL --config-dir=.
$configname add-zone-key
$zone rsasha256
1024 zsk active
2>&1
77 $PDNSUTIL --config-dir=.
$configname rectify-zone
$zone 2>&1
78 $PDNSUTIL --config-dir=.
$configname set-publish-cds
$zone 2>&1
79 $PDNSUTIL --config-dir=.
$configname set-publish-cdnskey
$zone 2>&1
81 # check if PKCS#11 should be used
82 if [ "$pkcs11" -eq 1 ]; then
83 if [ "$slot" == "" ]; then
88 sudo softhsm
--init-token --slot $slot --label label
$slot --pin 123$slot --so-pin 123$slot
89 kid
=`$PDNSUTIL --config-dir=. $configname hsm assign $zone ecdsa256 zsk softhsm label$slot 123$slot label$slot 2>&1 | grep softhsm | awk '{ print $NF }'`
90 kid
=`$PDNSUTIL --config-dir=. $configname show-zone $zone | grep 'ID =.*ZSK' | awk '{ print $3 }'`
91 $PDNSUTIL --config-dir=.
$configname hsm create-key
$zone $kid
93 $PDNSUTIL --config-dir=.
$configname secure-zone
$zone 2>&1
94 if [ "${zone: 0:20}" = "cdnskey-cds-test.com" ]; then
95 $PDNSUTIL --config-dir=.
$configname set-publish-cds
$zone 2>&1
96 $PDNSUTIL --config-dir=.
$configname set-publish-cdnskey
$zone 2>&1
109 echo "exitvalue$1" >> failed_tests
114 pids
=$
(cat pdns
*.pid
)
119 # make sure they die.
122 while [ $loopcount -lt 10 ] && [ $done -eq 0 ]
127 kill -0 $pid > /dev
/null
2>&1
133 let loopcount
=loopcount
+1
146 echo "$PDNS is not executable binary"
152 echo "$PDNS2 is not executable binary"
156 address
="${PDNS_LISTEN_ADDR:-127.0.0.1}"
158 [ -z "$port" ] && port
=5300
160 [ -z "$context" ] && context
=bind-dnssec
162 [ -z "$wait" ] && wait=nowait
164 [ -z "$cachettl" ] && cachettl
=0
169 if [ "$port" = help ] ||
[ "$context" = help ] ||
[ "$port" = "--help" ] ||
[ "$context" = "--help" ]
172 grep -v '^#' << '__EOF__'
174 Usage
: .
/start-test-stop
<port
> [<context
>] [wait|nowait
] [<cachettl
>] [<specifictest
>]
177 bind bind-dnssec bind-dnssec-nsec3 bind-dnssec-nsec3-optout bind-dnssec-nsec3-narrow
178 geoip geoip-nsec3-narrow
179 gmysql-nodnssec gmysql gmysql-nsec3 gmysql-nsec3-optout gmysql-nsec3-narrow
180 godbc_mssql-nodnssec godbc_mssql godbc_mssql-nsec3 godbc_mssql-nsec3-optout godbc_mssql-nsec3-narrow
181 goracle-nodnssec goracle goracle-nsec3 goracle-nsec3-optout goracle-nsec3-narrow
182 godbc_sqlite3-nodnssec godbc_sqlite3 godbc_sqlite3-nsec3 godbc_sqlite3-nsec3-optout godbc_sqlite3-narrow
183 gpgsql-nodnssec gpgsql gpgsql-nsec3 gpgsql-nsec3-optout gpgsql-nsec3-narrow
184 gsqlite3-nodnssec gsqlite3 gsqlite3-nsec3 gsqlite3-nsec3-optout gsqlite3-nsec3-narrow
188 oracle-nodnssec oracle oracle-nsec3
189 remotebackend-pipe remotebackend-unix remotebackend-http remotebackend-zeromq
190 remotebackend-pipe-dnssec remotebackend-unix-dnssec remotebackend-http-dnssec remotebackend-zeromq-dnssec
191 #remotebackend-pipe-nsec3 remotebackend-unix-nsec3 remotebackend-http-nsec3
192 #remotebackend-pipe-nsec3-narrow remotebackend-unix-nsec3-narrow remotebackend-http-nsec3-narrow
194 ldap-tree ldap-simple ldap-strict
195 lua2 lua2-dnssec lua2-nsec3 lua2-nsec3-narrow
196 #ext-nsd ext-nsd-nsec ext-nsd-nsec3 ext-bind ext-bind-nsec ext-bind-nsec3
198 * Add
-presigned to any ext-nsd
, ext-bind
, bind, gmysql or gsqlite3
test (except narrow
)
199 to
test presigned operation.
201 * Add
-both to any
bind or gmysql
test (except narrow
) to
202 test normal and presigned operation.
204 * Add
'wait' (literally
) after the context to not
kill
205 pdns_server immediately after testing.
'nowait' will
kill it.
207 * A cachettl can be supplied
if you want to run tests with a
208 ttl setting
set. The default cachettl is
0.
210 * Specifictest can be used to run only one single
test.
215 for prog
in $SDIG $SAXFR $NOTIFY $NSEC3DIG; do
216 if `echo $prog | grep -q '\.\./pdns'`; then
217 ${MAKE} -C ..
/pdns
${prog##*../pdns/} ||
exit
221 # Copy original zones because the test might modify them (well only the dyndns stuff, but let's make this work for others as well)
222 for zone
in $
(grep 'zone ' named.conf | cut
-f2 -d\")
224 if [ -f zones
/$zone.orig
]
226 cp -f zones
/$zone.orig zones
/$zone
237 if [[ "$context" =~ .
+-presigned.
* ]]
241 eval "$(echo "$context" | sed -r 's/(.+)(-presigned)(-(.*))?/context=\1 presignedcontext=\4/')"
242 if [ -z "$presignedcontext" ]
244 presignedcontext
=$context
248 if [ "${context: -5}" = "-both" ]
252 context
=${context%-both}
253 presignedcontext
=$context
259 if [ "${context: -13}" = "-nsec3-optout" ]
264 if [ "${context: -7}" = "-pkcs11" ]
267 context
=${context:0:-7}
271 if $PDNS --version 2>&1 |
grep Features
: |
grep -q "lua"
273 lua_prequery
="--lua-prequery-script=./check_stest_source"
280 source backends
/common
284 if [ "$skiplua" == "1" ]; then
285 skipreasons
="$skipreasons nolua"
291 nameserver
=127.0.0.1 .
/runtests
$spectest
297 if [ -s "./failed_tests" ]
299 for t
in `cat failed_tests`
302 cat ${testsdir}/$t/diff
311 ## TODO: give sdig a timeout
325 if [ $presigned = no
] ||
[ $both = yes ]
330 if [ $presigned = yes ] ||
[ $both = yes ]
341 if [ "$wait" = "wait" ]
343 echo tests
done! push enter to terminate instance
347 trap "kill_process $RETVAL" EXIT