tests.sh revision 75c622f53bdda9d2f69f05e06eaf7be01fc09a33
# 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.10 2011/11/18 19:32:13 each 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
#echo I:dig +noadd +noauth +nosearch +time=1 +tries=1 -p 5300 $* 1>&2
}
# set DIGNM=file name for dig output
TEST_NUM=0
while test -f $DIGNM; do
done
}
ret=1
echo "$*"
}
# (re)load the reponse policy zones with the rules in the file $TEST_FILE
if $NSUPDATE -v $TEST_FILE; then : ; else
echo "I:failed to update policy zone with $TEST_FILE"
exit 1
fi
fi
}
done
}
setret "$1"
return 1
}
# $1=message $2=optional test file name
ret=0
test -n "$1" && echo "I:checking $1"
TEST_FILE=$2
else
fi
TEST_NUM=0
}
fi
ckalive "I:failed; server crashed"
}
# $1=dig args $2=other dig output file
#ckalive "I:server crashed by 'dig $1'" || return 1
if $PERL ../digcomp.pl $DIGNM $2 >/dev/null; then
return 0
fi
return 1
}
# check only that the server does not crash
# $1=target domain $2=optional query type
ckalive "I:server crashed by 'dig $*'"
}
# check rewrite to NXDOMAIN
# $1=target domain $2=optional query type
}
# check rewrite to NODATA
# $1=target domain $2=optional query type
}
# check rewrite to an address
# modify the output so that it is easily compared, but save the original line
# $1=IPv4 address, $2=target domain $3=optional query type
ADDR=$1
shift
#ckalive "I:server crashed by 'dig $*'" || return
return 0
fi
}
# check that a response is not rewritten
# $1=target domain $2=optional query type
}
# check against a 'here document'
}
# make prototype files to check against rewritten results
status=0
nochange .
# check that IP addresses for previous group were deleted from the radix tree
start_group "radix tree deletions"
else
echo "I:NSDNAME not checked; named not configured with --enable-rpz-nsdname"
fi
else
echo "I:NSIP not checked; named not configured with --enable-rpz-nsip"
fi
# policies in ./test5 overridden by response-policy{} in ns3/named.conf
# check that miscellaneous bugs are still absent
start_group "crashes"
nocrash www.redirect -t$Q
nocrash www.credirect -t$Q
done
# restart the server to see if that creates a core file
if test -z "$HAVE_CORE"; then
fi
echo "I:exit status: $status"
exit $status