2013-03-20 14:31:10 -07:00
|
|
|
#!/bin/sh
|
2013-03-21 23:46:12 +00:00
|
|
|
#
|
2016-06-14 23:45:25 +00:00
|
|
|
# Copyright (C) 2013, 2014, 2016 Internet Systems Consortium, Inc. ("ISC")
|
2013-03-20 14:31:10 -07:00
|
|
|
#
|
2016-06-27 14:56:38 +10:00
|
|
|
# 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/.
|
2013-03-20 14:31:10 -07:00
|
|
|
|
|
|
|
SYSTEMTESTTOP=..
|
|
|
|
. $SYSTEMTESTTOP/conf.sh
|
|
|
|
|
|
|
|
COVERAGE="$COVERAGE -c ./named-compilezone"
|
|
|
|
|
|
|
|
status=0
|
|
|
|
n=1
|
|
|
|
|
|
|
|
matchall () {
|
|
|
|
file=$1
|
|
|
|
echo "$2" | while read matchline; do
|
|
|
|
grep "$matchline" $file > /dev/null 2>&1 || {
|
|
|
|
echo "FAIL"
|
|
|
|
return
|
|
|
|
}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking for DNSSEC key coverage issues"
|
2013-03-20 14:31:10 -07:00
|
|
|
ret=0
|
|
|
|
for dir in [0-9][0-9]-*; do
|
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "$dir"
|
2013-03-20 14:31:10 -07:00
|
|
|
args= warn= error= ok= retcode= match=
|
|
|
|
. $dir/expect
|
|
|
|
$COVERAGE $args -K $dir example.com > coverage.$n 2>&1
|
|
|
|
|
|
|
|
# check that return code matches expectations
|
2014-01-10 17:53:21 -08:00
|
|
|
found=$?
|
|
|
|
if [ $found -ne $retcode ]; then
|
|
|
|
echo "retcode was $found expected $retcode"
|
|
|
|
ret=1
|
|
|
|
fi
|
2013-03-20 14:31:10 -07:00
|
|
|
|
|
|
|
# check for correct number of errors
|
|
|
|
found=`grep ERROR coverage.$n | wc -l`
|
2014-01-10 17:53:21 -08:00
|
|
|
if [ $found -ne $error ]; then
|
|
|
|
echo "error count was $found expected $error"
|
|
|
|
ret=1
|
|
|
|
fi
|
2013-03-20 14:31:10 -07:00
|
|
|
|
|
|
|
# check for correct number of warnings
|
|
|
|
found=`grep WARNING coverage.$n | wc -l`
|
2014-01-10 17:53:21 -08:00
|
|
|
if [ $found -ne $warn ]; then
|
|
|
|
echo "warning count was $found expected $warn"
|
|
|
|
ret=1
|
|
|
|
fi
|
2013-03-20 14:31:10 -07:00
|
|
|
|
|
|
|
# check for correct number of OKs
|
|
|
|
found=`grep "No errors found" coverage.$n | wc -l`
|
2014-01-10 17:53:21 -08:00
|
|
|
if [ $found -ne $ok ]; then
|
|
|
|
echo "good count was $found expected $ok"
|
|
|
|
ret=1
|
|
|
|
fi
|
2013-03-20 14:31:10 -07:00
|
|
|
|
|
|
|
found=`matchall coverage.$n "$match"`
|
2014-01-10 17:53:21 -08:00
|
|
|
if [ "$found" = "FAIL" ]; then
|
|
|
|
echo "no match on '$match'"
|
|
|
|
ret=1
|
|
|
|
fi
|
2013-03-20 14:31:10 -07:00
|
|
|
|
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2013-03-20 14:31:10 -07:00
|
|
|
status=`expr $status + $ret`
|
|
|
|
done
|
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "exit status: $status"
|
2016-06-14 13:48:39 +10:00
|
|
|
[ $status -eq 0 ] || exit 1
|