tests.sh revision 9cee5bb02863bf191e12cd4297adabf1971020de
# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
#
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: tests.sh,v 1.3 2011/01/13 04:59:24 tbox Exp $
# test response policy zones (RPZ)
USAGE="$0: [-x]"
while getopts "x" c; do
case $c in
x) set -x;;
esac
done
exit 1
fi
# really quit on control-C
trap 'exit 1' 1 2 15
# set DIGNM=file name for dig output
# $1=target domain $2=optional query type $3=optional string
if test -n "$3"; then
fi
if test -n "$2"; then
fi
}
ret=1
echo "$*"
}
# check rewrite to NXDOMAIN
# $1=target domain $2=optional query type
dignm $1 "$2"
}
# check rewrite to NODATA
# $1=target domain $2=optional query type
dignm $1 "$2"
}
# check rewrite to "A 12.12.12.12"
# modify the output so that it is easily matched, but save the original line
# $1=target domain $2=optional query type
dignm $1 "$2"
}
# check that a response is not rewritten
# $1=target domain $2=optional query type
dignm $1 "$2"
$PERL ../digcomp.pl $DIGNM_OK $DIGNM || ret=1
}
echo "I:failed to freeze policy zone $1"
exit 1
fi
echo "I:failed to thaw policy zone $1"
exit 1
fi
}
# $1=message $2=test file
ret=0
if test -n "$1"; then
echo "I:checking $1"
fi
PREV_FILE=$2
if test -n "$2"; then
if $NSUPDATE -v $PREV_FILE; then : ; else
echo "I:failed to update policy zone $1 with $2"
exit 1
fi
#flush_db
else
DIGNM_SUB="${DIGNM_SUB}x"
fi
}
if test $ret != 0; then
echo "I:failed"
else
fi
#flush_db
fi
}
# make NXDOMAIN and NODATA prototypes
echo "I:making prototype RPZ NXDOMAIN, NODATA, and CNAME results"
status=0
start_test "RPZ radix tree deletions"
else
echo "I:RPZ NSDNAME not checked; named was not built with --enable-rpz-nsdname"
fi
nochange .
else
echo "I:RPZ NSIP not checked; named was not built with --enable-rpz-nsip"
fi
echo "'policy cname' failed"
ret=1
fi
fi
echo "I:exit status: $status"
exit $status