1#!/bin/sh 2# 3# Copyright (C) 2013, 2014 Internet Systems Consortium, Inc. ("ISC") 4# 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. 8# 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. 16 17SYSTEMTESTTOP=.. 18. $SYSTEMTESTTOP/conf.sh 19 20COVERAGE="$COVERAGE -c ./named-compilezone" 21 22status=0 23n=1 24 25matchall () { 26 file=$1 27 echo "$2" | while read matchline; do 28 grep "$matchline" $file > /dev/null 2>&1 || { 29 echo "FAIL" 30 return 31 } 32 done 33} 34 35echo "I:checking for DNSSEC key coverage issues" 36ret=0 37for 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 43 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 49 fi 50 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 56 fi 57 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 63 fi 64 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 70 fi 71 72 found=`matchall coverage.$n "$match"` 73 if [ "$found" = "FAIL" ]; then 74 echo "no match on '$match'" 75 ret=1 76 fi 77 78 n=`expr $n + 1` 79 if [ $ret != 0 ]; then echo "I:failed"; fi 80 status=`expr $status + $ret` 81done 82 83echo "I:exit status: $status" 84exit $status 85