1#!/bin/sh
2#
3# Copyright (C) 2009  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
17# $Id: run-test.sh,v 1.3 2009/06/04 02:56:47 tbox Exp $
18
19
20sign="../../dnssec/dnssec-signzone -f signed.zone -o example.com."
21
22signit() {
23	rm -f signed.zone
24	grep '^;' $zone
25	$sign $zone
26}
27
28expect_success() {
29	if ! test -f signed.zone ; then
30		echo "Error: expected success, but sign failed for $zone."
31	else
32		echo "Success:  Sign succeeded for $zone."
33	fi
34}
35
36expect_failure() {
37	if test -f signed.zone ; then
38		echo "Error: expected failure, but sign succeeded for $zone."
39	else
40		echo "Success:  Sign failed (expected) for $zone"
41	fi
42}
43
44zone="test1.zone" ; signit ; expect_success
45zone="test2.zone" ; signit ; expect_failure
46zone="test3.zone" ; signit ; expect_failure
47zone="test4.zone" ; signit ; expect_success
48zone="test5.zone" ; signit ; expect_failure
49zone="test6.zone" ; signit ; expect_failure
50zone="test7.zone" ; signit ; expect_failure
51zone="test8.zone" ; signit ; expect_failure
52