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}
22 ALGORITHM
=${ALGORITHM:="hmac-md5"}
23 KEY
=${KEY:="kp4/24gyYsEzbuTVJRUMoqGFmN3LYgVDzJ/3oRSP7ys="}
30 trap "kill_process 2" EXIT INT TERM
32 source ..
/regression-tests
/common
38 domcount
=$
(grep -c ^zone named.conf
)
39 if [ ! -x $PDNSCONTROL ]
41 echo "No pdns_control found"
46 while [ $loopcount -lt 20 ]
49 done=$
( ($PDNSCONTROL --config-name=$configname --socket-dir=.
--no-config bind-domain-status || true
) |
grep -c 'parsed into memory' || true
)
50 if [ $done = $domcount ]
54 let loopcount
=loopcount
+1
57 if [ $done != $domcount ]
59 echo "Domain parsing failed" >> failed_tests
68 if [ -n "$configname" ]
70 configname
="--config-name=$configname"
72 if [ "${zone: 0:16}" = "secure-delegated" ]
74 $PDNSUTIL --config-dir=.
$configname import-zone-key
$zone $zone.private ksk
2>&1
75 $PDNSUTIL --config-dir=.
$configname add-zone-key
$zone rsasha256
1024 zsk active
2>&1
76 $PDNSUTIL --config-dir=.
$configname rectify-zone
$zone 2>&1
77 $PDNSUTIL --config-dir=.
$configname set-publish-cds
$zone 2>&1
78 $PDNSUTIL --config-dir=.
$configname set-publish-cdnskey
$zone 2>&1
80 # check if PKCS#11 should be used
81 if [ "$pkcs11" -eq 1 ]; then
82 if [ "$slot" == "" ]; then
87 sudo softhsm
--init-token --slot $slot --label label
$slot --pin 123$slot --so-pin 123$slot
88 kid
=`$PDNSUTIL --config-dir=. $configname hsm assign $zone ecdsa256 zsk softhsm label$slot 123$slot label$slot 2>&1 | grep softhsm | awk '{ print $NF }'`
89 kid
=`$PDNSUTIL --config-dir=. $configname show-zone $zone | grep 'ID =.*ZSK' | awk '{ print $3 }'`
90 $PDNSUTIL --config-dir=.
$configname hsm create-key
$zone $kid
92 $PDNSUTIL --config-dir=.
$configname secure-zone
$zone 2>&1
93 if [ "${zone: 0:20}" = "cdnskey-cds-test.com" ]; then
94 $PDNSUTIL --config-dir=.
$configname set-publish-cds
$zone 2>&1
95 $PDNSUTIL --config-dir=.
$configname set-publish-cdnskey
$zone 2>&1
108 echo "exitvalue$1" >> failed_tests
113 pids
=$
(cat pdns
*.pid
)
118 # make sure they die.
121 while [ $loopcount -lt 10 ] && [ $done -eq 0 ]
126 kill -0 $pid > /dev
/null
2>&1
132 let loopcount
=loopcount
+1
145 echo "$PDNS is not executable binary"
151 echo "$PDNS2 is not executable binary"
155 address
="${PDNS_LISTEN_ADDR:-127.0.0.1}"
157 [ -z "$port" ] && port
=5300
159 [ -z "$context" ] && context
=bind-dnssec
161 [ -z "$wait" ] && wait=nowait
163 [ -z "$cachettl" ] && cachettl
=0
168 if [ "$port" = help ] ||
[ "$context" = help ] ||
[ "$port" = "--help" ] ||
[ "$context" = "--help" ]
171 grep -v '^#' << '__EOF__'
173 Usage
: .
/start-test-stop
<port
> [<context
>] [wait|nowait
] [<cachettl
>] [<specifictest
>]
176 bind bind-dnssec bind-dnssec-nsec3 bind-dnssec-nsec3-optout bind-dnssec-nsec3-narrow
177 geoip geoip-nsec3-narrow
178 gmysql-nodnssec gmysql gmysql-nsec3 gmysql-nsec3-optout gmysql-nsec3-narrow
179 godbc_mssql-nodnssec godbc_mssql godbc_mssql-nsec3 godbc_mssql-nsec3-optout godbc_mssql-nsec3-narrow
180 goracle-nodnssec goracle goracle-nsec3 goracle-nsec3-optout goracle-nsec3-narrow
181 godbc_sqlite3-nodnssec godbc_sqlite3 godbc_sqlite3-nsec3 godbc_sqlite3-nsec3-optout godbc_sqlite3-narrow
182 gpgsql-nodnssec gpgsql gpgsql-nsec3 gpgsql-nsec3-optout gpgsql-nsec3-narrow
183 gsqlite3-nodnssec gsqlite3 gsqlite3-nsec3 gsqlite3-nsec3-optout gsqlite3-nsec3-narrow
187 oracle-nodnssec oracle oracle-nsec3
188 remotebackend-pipe remotebackend-unix remotebackend-http remotebackend-zeromq
189 remotebackend-pipe-dnssec remotebackend-unix-dnssec remotebackend-http-dnssec remotebackend-zeromq-dnssec
190 #remotebackend-pipe-nsec3 remotebackend-unix-nsec3 remotebackend-http-nsec3
191 #remotebackend-pipe-nsec3-narrow remotebackend-unix-nsec3-narrow remotebackend-http-nsec3-narrow
193 ldap-tree ldap-simple ldap-strict
194 lua2 lua2-dnssec lua2-nsec3 lua2-nsec3-narrow
195 #ext-nsd ext-nsd-nsec ext-nsd-nsec3 ext-bind ext-bind-nsec ext-bind-nsec3
197 * Add
-presigned to any ext-nsd
, ext-bind
, bind, gmysql or gsqlite3
test (except narrow
)
198 to
test presigned operation.
200 * Add
-both to any
bind or gmysql
test (except narrow
) to
201 test normal and presigned operation.
203 * Add
'wait' (literally
) after the context to not
kill
204 pdns_server immediately after testing.
'nowait' will
kill it.
206 * A cachettl can be supplied
if you want to run tests with a
207 ttl setting
set. The default cachettl is
0.
209 * Specifictest can be used to run only one single
test.
214 for prog
in $SDIG $SAXFR $NOTIFY $NSEC3DIG; do
215 if `echo $prog | grep -q '\.\./pdns'`; then
216 ${MAKE} -C ..
/pdns
${prog##*../pdns/} ||
exit
220 # Copy original zones because the test might modify them (well only the dyndns stuff, but let's make this work for others as well)
221 for zone
in $
(grep 'zone ' named.conf | cut
-f2 -d\")
223 if [ -f zones
/$zone.orig
]
225 cp -f zones
/$zone.orig zones
/$zone
236 if [[ "$context" =~ .
+-presigned.
* ]]
240 eval "$(echo "$context" | sed -r 's/(.+)(-presigned)(-(.*))?/context=\1 presignedcontext=\4/')"
241 if [ -z "$presignedcontext" ]
243 presignedcontext
=$context
247 if [ "${context: -5}" = "-both" ]
251 context
=${context%-both}
252 presignedcontext
=$context
258 if [ "${context: -13}" = "-nsec3-optout" ]
263 if [ "${context: -7}" = "-pkcs11" ]
266 context
=${context:0:-7}
270 if $PDNS --version 2>&1 |
grep Features
: |
grep -q "lua"
272 lua_prequery
="--lua-prequery-script=./check_stest_source"
279 source backends
/common
283 if [ "$skiplua" == "1" ]; then
284 skipreasons
="$skipreasons nolua"
290 nameserver
=127.0.0.1 .
/runtests
$spectest
296 if [ -s "./failed_tests" ]
298 for t
in `cat failed_tests`
301 cat ${testsdir}/$t/diff
310 ## TODO: give sdig a timeout
324 if [ $presigned = no
] ||
[ $both = yes ]
329 if [ $presigned = yes ] ||
[ $both = yes ]
340 if [ "$wait" = "wait" ]
342 echo tests
done! push enter to terminate instance
346 trap "kill_process $RETVAL" EXIT