f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt# Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Huntecho "I:checking for DNSSEC key coverage issues"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt echo "I:$dir ($n)"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt kargs= cargs= kmatch= cmatch= kret= cret=0 warn= error= ok=
d907426f0f5b6100cbe4d03e417f59ce67ff171bEvan Hunt # use policy.conf if available
d907426f0f5b6100cbe4d03e417f59ce67ff171bEvan Hunt [ -e "$dir/policy.conf" ] && policy="-c $dir/policy.conf"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt # run keymgr to update keys
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki if [ "$CYGWIN" ]; then
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki $KEYMGR $policy -K $dir -g `cygpath -w $KEYGEN` -r $RANDFILE \
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki -s `cygpath -w $SETTIME` $kargs > keymgr.$n 2>&1
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki $KEYMGR $policy -K $dir -g $KEYGEN -r $RANDFILE \
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt # check that return code matches expectations
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt echo "keymgr retcode was $found expected $kret"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt echo "no match on '$kmatch'"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt # now check coverage
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt # check that return code matches expectations
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt echo "coverage retcode was $found expected $cret"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt # check for correct number of errors
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt echo "error count was $found expected $error"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt # check for correct number of warnings
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt echo "warning count was $found expected $warn"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt # check for correct number of OKs
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt found=`grep "No errors found" coverage.$n | wc -l`
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt echo "good count was $found expected $ok"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Hunt echo "no match on '$cmatch'"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Huntecho "I:checking policy.conf parser ($n)"
f6096b958c8b58c4709860d7c4dcdde5deeacb7aEvan Huntecho "I:exit status: $status"