Files
unbound/testdata/auth_load_tree.tdir/auth_load_tree.pre
T

109 lines
2.9 KiB
Plaintext

# #-- auth_load_tree.pre--#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test
PRE="../.."
. ../common.sh
# if no threads; exit
if grep -e "define HAVE_PTHREAD 1" -e "define HAVE_SOLARIS_THREADS 1" -e "define HAVE_WINDOWS_THREADS 1" $PRE/config.h; then
echo "have threads"
else
skip_test "no threads"
fi
get_random_port 2
UNBOUND_PORT=$RND_PORT
FWD_PORT=$(($RND_PORT + 1))
echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
NUM_AUTH=120
echo "NUM_AUTH=$NUM_AUTH" >> .tpkg.var.test
echo "" > auth.zonelist
# start forwarder
# create auth_load_tree.testns
for((i=1; i<=$NUM_AUTH; i++)); do
cat >>auth_load_tree.testns <<EOF
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
example$i.com. IN SOA
SECTION ANSWER
example$i.com. IN SOA ns.example$i.com. hostmaster.example$i.com. 1 3600 900 86400 3600
ENTRY_END
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
example$i.com. IN AXFR
SECTION ANSWER
example$i.com. IN SOA ns.example$i.com. hostmaster.example$i.com. 1 3600 900 86400 3600
example$i.com. IN NS ns.example.net.
EXTRA_PACKET
REPLY QR AA NOERROR
SECTION QUESTION
example$i.com. IN AXFR
SECTION ANSWER
www.example$i.com. IN A 1.2.3.4
h1.example$i.com. IN A 1.2.3.5
h2.example$i.com. IN A 1.2.3.5
h3.example$i.com. IN A 1.2.3.5
h4.example$i.com. IN A 1.2.3.5
h5.example$i.com. IN A 1.2.3.5
h6.example$i.com. IN A 1.2.3.5
h7.example$i.com. IN A 1.2.3.5
h8.example$i.com. IN A 1.2.3.5
h9.example$i.com. IN A 1.2.3.5
h10.example$i.com. IN A 1.2.3.5
h11.example$i.com. IN A 1.2.3.5
h12.example$i.com. IN A 1.2.3.5
h13.example$i.com. IN A 1.2.3.5
h14.example$i.com. IN A 1.2.3.5
h15.example$i.com. IN A 1.2.3.5
h16.example$i.com. IN A 1.2.3.5
example$i.com. IN SOA ns.example$i.com. hostmaster.example$i.com. 1 3600 900 86400 3600
ENTRY_END
EOF
cat >>auth.zonelist <<EOF
auth-zone:
name: "example$i.com"
for-upstream: yes
for-downstream: yes
master: "127.0.0.1@${FWD_PORT}@"
EOF
done
get_ldns_testns
$LDNS_TESTNS -p $FWD_PORT auth_load_tree.testns >fwd.log 2>&1 &
FWD_PID=$!
echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
# make config file
CONTROL_PATH=/tmp
CONTROL_PID=$$
sed -e 's/@PORT\@/'$UNBOUND_PORT'/' \
-e 's/@TOPORT\@/'$FWD_PORT'/' \
-e 's?@CONTROL_PATH\@?'$CONTROL_PATH'?' \
-e 's/@CONTROL_PID@/'$CONTROL_PID'/' \
< auth_load_tree.conf > ub.conf
# start unbound in the background
$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
#valgrind --leak-check=full --show-reachable=yes $PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
UNBOUND_PID=$!
echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
echo "CONTROL_PATH=$CONTROL_PATH" >> .tpkg.var.test
echo "CONTROL_PID=$CONTROL_PID" >> .tpkg.var.test
cat .tpkg.var.test
wait_ldns_testns_up fwd.log
wait_unbound_up unbound.log