tests.sh revision d907426f0f5b6100cbe4d03e417f59ce67ff171b
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley# This Source Code Form is subject to the terms of the Mozilla Public
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley# License, v. 2.0. If a copy of the MPL was not distributed with this
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# file, You can obtain one at http://mozilla.org/MPL/2.0/.
def8e47c688e2480a4539d69c3d1a0a28a7c0550Mark Andrewsecho "I:checking for DNSSEC key coverage issues"
8dfa9caeec8e68db0c937e347a3d6629e7627d54Bob Halley echo "I:$dir ($n)"
54f959d12b5a1f9315fbf6a776c6d349316e9686Bob Halley kargs= cargs= kmatch= cmatch= kret= cret=0 warn= error= ok=
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley # use policy.conf if available
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley [ -e "$dir/policy.conf" ] && policy="-c $dir/policy.conf"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley # run keymgr to update keys
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley $KEYMGR $policy -K $dir -g $KEYGEN -r $RANDFILE -s $SETTIME $kargs > keymgr.$n 2>&1
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley # check that return code matches expectations
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley echo "keymgr retcode was $found expected $kret"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley echo "no match on '$kmatch'"
b12f0228b32775ee688ed21ddbf3a116c1adfb43Michael Graff # now check coverage
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley # check that return code matches expectations
80b782f356f0692c11b4e52e8dd46ec41704e5a2Mark Andrews echo "coverage retcode was $found expected $cret"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley # check for correct number of errors
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley echo "error count was $found expected $error"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley # check for correct number of warnings
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence echo "warning count was $found expected $warn"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley # check for correct number of OKs
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley found=`grep "No errors found" coverage.$n | wc -l`
732e0731dec1922747bb3b3147cf2c3d16b22eaaBob Halley echo "good count was $found expected $ok"
80b782f356f0692c11b4e52e8dd46ec41704e5a2Mark Andrews echo "no match on '$cmatch'"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyecho "I:checking policy.conf parser ($n)"
078d49b63324f01d98301ee21671abee0c41fcdeBob Halley${PYTHON} testpolicy.py policy.sample > policy.out
904a5734375869ffb504ed8cde6b68cafadb6d64Bob Halleyecho "I:exit status: $status"