]> git.ipfire.org Git - thirdparty/pdns.git/blame - regression-tests/recursor-test
Also update surrounding text as noted by phonedph1
[thirdparty/pdns.git] / regression-tests / recursor-test
CommitLineData
045e4577 1#!/bin/bash -e
b3bd2e75
PD
2port=$1
3[ -z "$port" ] && port=5300
4limit=$2
dfddcdaf 5[ -z "$limit" ] && limit=100000
045e4577
OM
6threads=$3
7[ -z "$threads" ] && threads=2
8mthreads=$4
9[ -z "$mthreads" ] && mthreads=100
359d6c17
OM
10shards=$5
11[ -z "$shards" ] && shards=1024
b3bd2e75 12
cb99a652 13: ${RECURSOR:="../pdns/recursordist/pdns_recursor"}
38645cdf 14: ${RECCONTROL:="../pdns/recursordist/rec_control"}
923c8ad1 15: ${CSV:="top-1m.csv"}
8a27076c 16: ${IPv6:="0"}
f0f39fda 17: ${TRACE:="fail"}
ae7072eb 18: ${DNSBULKTEST:="../pdns/dnsbulktest"}
923c8ad1
PD
19
20if [ $IPv6 = 1 ]
21then
22 QLA6="::"
23else
24 QLA6=""
25fi
26
27rm -f recursor.pid pdns_recursor.pid
5e94ec93
PD
28/usr/bin/time --format '%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
29%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
30<measurement><name>user CPU seconds</name><value>%U</value></measurement>
31<measurement><name>system CPU seconds</name><value>%S</value></measurement>
32<measurement><name>wallclock seconds</name><value>%e</value></measurement>
33<measurement><name>%% CPU used</name><value>%P</value></measurement>
359d6c17 34' ${RECURSOR} --daemon=no --local-port=$port --socket-dir=./ --trace=$TRACE --config-dir=. --max-mthreads=$mthreads --query-local-address6="${QLA6}" --threads=$threads --cache-shards=$shards --disable-packetcache > recursor.log 2>&1 &
b3bd2e75 35sleep 3
045e4577
OM
36
37# warm up the cache
38echo
359d6c17 39echo === First run with limit=$limit threads=$threads mthreads=$mthreads shards=$shards ===
045e4577 40${DNSBULKTEST} --www=false -qe 127.0.0.1 $port $limit < ${CSV} > bulktest.results
38645cdf
OM
41kill -USR1 $(cat pdns_recursor.pid)
42${RECCONTROL} --socket-dir=. --config-dir=. get-all
81cb91db 43# rerun 1 with hot cache
045e4577 44echo
359d6c17 45echo === Second run with limit=$limit threads=$threads mthreads=$mthreads shards=$shards ===
8a27076c 46${DNSBULKTEST} --www=false -qe 127.0.0.1 $port $limit < ${CSV} > bulktest.results
38645cdf
OM
47kill -USR1 $(cat pdns_recursor.pid)
48${RECCONTROL} --socket-dir=. --config-dir=. get-all
81cb91db
OM
49# rerun 2 with hot cache
50echo
359d6c17 51echo === Third run with limit=$limit threads=$threads mthreads=$mthreads shards=$shards ===
81cb91db 52${DNSBULKTEST} --www=false -qe 127.0.0.1 $port $limit < ${CSV} > bulktest.results
38645cdf
OM
53kill -USR1 $(cat pdns_recursor.pid)
54${RECCONTROL} --socket-dir=. --config-dir=. get-all
045e4577 55
38645cdf 56sleep 1
045e4577
OM
57echo
58echo "=== RECURSOR LOG ==="
6f556c33 59cat recursor.log
045e4577 60echo "=== END RECURSOR LOG ==="
38645cdf 61kill $(cat pdns_recursor.pid)
8e7b1ed4 62sleep 5
dfddcdaf
PD
63
64. ./bulktest.results
65
66mkdir -p recursor-bulktest
67rm -f failed_tests passed_tests
68touch failed_tests passed_tests
4108e18b 69: ${THRESHOLD:="95"}
8a27076c 70
71ANANSWER=$[(100*(${DBT_QUEUED}-${DBT_ERRORS}-${DBT_TIMEOUTS}) )/${DBT_QUEUED}]
72
73if [ "$ANANSWER" -ge $THRESHOLD ]
dfddcdaf
PD
74then
75 echo recursor-bulktest >> passed_tests
be80e5f9 76 RETVAL=0
dfddcdaf
PD
77else
78 echo recursor-bulktest >> failed_tests
be80e5f9 79 RETVAL=1
dfddcdaf
PD
80fi
81
82echo "$DBT_OKPERCENTAGE% of domains resolved" > recursor-bulktest/diff
6a6d742b 83egrep 'PowerDNS.COM|^<measurement' recursor.log > recursor-bulktest/stdout
5e94ec93 84echo "<measurement><name>% domains resolved</name><value>$DBT_OKPERCENTAGE</value></measurement>" >> recursor-bulktest/stdout
dfddcdaf 85
dbe48e99
PD
86: ${context:="recursor-bulktest"}
87
88export context
89testsdir=. ./toxml
be80e5f9
KM
90
91exit $RETVAL