tests.sh revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
#
# Copyright (C) 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
status=0
t=0
# $1 = test name (such as 1a, 1b, etc. for which named.$1.conf exists)
TESTNAME=$1
echo "I:stopping resolver"
sleep 1
echo "I:starting resolver using named.$TESTNAME.conf"
}
TESTNAME=$1
LINE=$2
return 0
}
# $1 = test name (such as 1a, 1b, etc. for which $1.queries exists)
# $2 = line number in query file to test (the name to query is taken from this line)
TESTNAME=$1
LINE=$2
t=`expr $t + 1`
echo "I:testing $NAME doesn't recurse (${t})"
echo "I:test ${t} failed"
status=1
}
}
# $1 = test name (such as 1a, 1b, etc. for which $1.queries exists)
# $2 = line number in query file to test (the name to query is taken from this line)
TESTNAME=$1
LINE=$2
t=`expr $t + 1`
echo "I:testing $NAME recurses (${t})"
echo "I:test ${t} failed"
status=1
}
}
t=`expr $t + 1`
echo "I:testing that l1.l0 exists without RPZ (${t})"
echo "I:test ${t} failed"
status=1
}
t=`expr $t + 1`
echo "I:testing that l2.l1.l0 returns SERVFAIL without RPZ (${t})"
echo "I:test ${t} failed"
status=1
}
# Group 1
run_server 1a
run_server 1b
run_server 1c
# Group 2
run_server 2a
do
expect_norecurse 2a $n
done
# Group 3
run_server 3a
run_server 3b
run_server 3c
run_server 3d
run_server 3e
run_server 3f
# Group 4
testlist="aa ap bf"
values="1 16 32"
# Uncomment the following to test every skip value instead of
# only a sample of values
#
#testlist="aa ab ac ad ae af ag ah ai aj ak al am an ao ap \
# aq ar as at au av aw ax ay az ba bb bc bd be bf"
#values="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
# 21 22 23 24 25 26 27 28 29 30 31 32"
set -- $values
run_server 4$n
ni=$1
t=`expr $t + 1`
echo "I:testing that ${ni} of 33 queries skip recursion (${t})"
c=0
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
do
run_query 4$n $i
c=`expr $c + $?`
done
status=1
fi
shift
done
# Group 5
run_server 5a
# Group 6
echo "I:check recursive behavior consistency during policy update races"
run_server 6a
sleep 1
t=`expr $t + 1`
echo "I:running dig to cache CNAME record (${t})"
sleep 1
echo "I:suspending authority server"
echo "I:adding an NSDNAME policy"
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
sleep 1
t=`expr $t + 1`
echo "I:running dig to follow CNAME (blocks, so runs in the background) (${t})"
sleep 1
echo "I:removing the NSDNAME policy"
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
sleep 1
echo "I:resuming authority server"
sleep 1
[ -s dig.out.${t} ] || continue
echo "I:test ${t} failed"
status=1
}
done
echo "I:check recursive behavior consistency during policy removal races"
run_server 6a
sleep 1
t=`expr $t + 1`
echo "I:running dig to cache CNAME record (${t})"
sleep 1
echo "I:suspending authority server"
echo "I:adding an NSDNAME policy"
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
sleep 1
t=`expr $t + 1`
echo "I:running dig to follow CNAME (blocks, so runs in the background) (${t})"
sleep 1
echo "I:removing the policy zone"
sleep 1
echo "I:resuming authority server"
sleep 1
[ -s dig.out.${t} ] || continue
echo "I:test ${t} failed"
status=1
}
done
# Check CLIENT-IP behavior
t=`expr $t + 1`
echo "I:testing CLIENT-IP behavior (${t})"
echo "I:test $t failed: query failed"
status=1
}
echo "I:test $t failed: didn't get expected answer"
status=1
}
# Check RPZ log clause
t=`expr $t + 1`
echo "I:testing RPZ log clause (${t})"
sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.4.0.53.10.rpz-client-ip.log1" > /dev/null && {
echo "I: failed: unexpected rewrite message for policy zone log1 was logged"
status=1
}
sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.3.0.53.10.rpz-client-ip.log2" > /dev/null || {
echo "I: failed: expected rewrite message for policy zone log2 was not logged"
status=1
}
sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.2.0.53.10.rpz-client-ip.log3" > /dev/null || {
echo "I: failed: expected rewrite message for policy zone log3 was not logged"
status=1
}
# Check wildcard behavior
t=`expr $t + 1`
echo "I:testing wildcard behavior with 1 RPZ zone (${t})"
echo "I:test ${t} failed"
status=1
}
echo "I:test ${t} failed"
status=1
}
t=`expr $t + 1`
echo "I:testing wildcard behavior with 2 RPZ zones (${t})"
echo "I:test ${t} failed"
status=1
}
echo "I:test ${t} failed"
status=1
}
t=`expr $t + 1`
echo "I:testing wildcard behavior with 1 RPZ zone and no non-wildcard triggers (${t})"
echo "I:test ${t} failed"
status=1
}
echo "I:test ${t} failed"
status=1
}
t=`expr $t + 1`
echo "I:checking 'nsip-wait-recurse no' is faster than 'nsip-wait-recurse yes' ($t)"
echo "I:timing 'nsip-wait-recurse yes' (default)"
ret=0
echo "I:elasped time $p1 seconds"
echo "I:timing 'nsip-wait-recurse no'"
echo "I:elasped time $p2 seconds"
echo "I:exit status: $status"