etc/services - sync with NetBSD-8
[minix.git] / external / bsd / bind / dist / bin / tests / system / coverage / tests.sh
blob099bdefabd09c174c02e302cb2ba8c8fbbae9d93
1 #!/bin/sh
3 # Copyright (C) 2013, 2014 Internet Systems Consortium, Inc. ("ISC")
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 # PERFORMANCE OF THIS SOFTWARE.
17 SYSTEMTESTTOP=..
18 . $SYSTEMTESTTOP/conf.sh
20 COVERAGE="$COVERAGE -c ./named-compilezone"
22 status=0
23 n=1
25 matchall () {
26 file=$1
27 echo "$2" | while read matchline; do
28 grep "$matchline" $file > /dev/null 2>&1 || {
29 echo "FAIL"
30 return
32 done
35 echo "I:checking for DNSSEC key coverage issues"
36 ret=0
37 for dir in [0-9][0-9]-*; do
38 ret=0
39 echo "I:$dir"
40 args= warn= error= ok= retcode= match=
41 . $dir/expect
42 $COVERAGE $args -K $dir example.com > coverage.$n 2>&1
44 # check that return code matches expectations
45 found=$?
46 if [ $found -ne $retcode ]; then
47 echo "retcode was $found expected $retcode"
48 ret=1
51 # check for correct number of errors
52 found=`grep ERROR coverage.$n | wc -l`
53 if [ $found -ne $error ]; then
54 echo "error count was $found expected $error"
55 ret=1
58 # check for correct number of warnings
59 found=`grep WARNING coverage.$n | wc -l`
60 if [ $found -ne $warn ]; then
61 echo "warning count was $found expected $warn"
62 ret=1
65 # check for correct number of OKs
66 found=`grep "No errors found" coverage.$n | wc -l`
67 if [ $found -ne $ok ]; then
68 echo "good count was $found expected $ok"
69 ret=1
72 found=`matchall coverage.$n "$match"`
73 if [ "$found" = "FAIL" ]; then
74 echo "no match on '$match'"
75 ret=1
78 n=`expr $n + 1`
79 if [ $ret != 0 ]; then echo "I:failed"; fi
80 status=`expr $status + $ret`
81 done
83 echo "I:exit status: $status"
84 exit $status