From 2bef3713093349af52ba61eaab07adf3207da873 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 23 Jun 2005 06:52:23 +0000 Subject: [PATCH] 1890. [func] Add a system test for named-checkconf. [RT #14931] --- CHANGES | 2 + bin/check/named-checkconf.c | 8 +--- bin/tests/system/checkconf/bad.conf | 52 ++++++++++++++++++++++++++ bin/tests/system/checkconf/good.conf | 56 ++++++++++++++++++++++++++++ bin/tests/system/checkconf/tests.sh | 37 ++++++++++++++++++ bin/tests/system/conf.sh.in | 9 +++-- util/copyrights | 3 ++ 7 files changed, 156 insertions(+), 11 deletions(-) create mode 100644 bin/tests/system/checkconf/bad.conf create mode 100644 bin/tests/system/checkconf/good.conf create mode 100644 bin/tests/system/checkconf/tests.sh diff --git a/CHANGES b/CHANGES index 9680945764..57c1d5592e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +1890. [func] Add a system test for named-checkconf. [RT #14931] + 1889. [func] The lame cache is now done on a basis as some servers only appear to be lame for certain query types. [RT #14916] diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 7f137a3f92..54789e4272 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named-checkconf.c,v 1.34 2005/06/20 01:03:48 marka Exp $ */ +/* $Id: named-checkconf.c,v 1.35 2005/06/23 06:52:22 marka Exp $ */ /*! \file */ @@ -400,10 +400,6 @@ main(int argc, char **argv) { RUNTIME_CHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_entropy_create(mctx, &ectx) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE) - == ISC_R_SUCCESS); - dns_result_register(); RUNTIME_CHECK(cfg_parser_create(mctx, logc, &parser) == ISC_R_SUCCESS); @@ -430,8 +426,6 @@ main(int argc, char **argv) { cfg_parser_destroy(&parser); - isc_hash_destroy(); - isc_log_destroy(&logc); isc_hash_destroy(); diff --git a/bin/tests/system/checkconf/bad.conf b/bin/tests/system/checkconf/bad.conf new file mode 100644 index 0000000000..c3592e84a7 --- /dev/null +++ b/bin/tests/system/checkconf/bad.conf @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and distribute this software for any + * 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: bad.conf,v 1.2 2005/06/23 06:52:23 marka Exp $ */ + +options { + avoid-v4-udp-ports { 100; } + avoid-v6-udp-ports { 100; }; + blackhole { 10.0.0.0/8; }; + coresize 1G; + datasize 100M; + deallocate-on-exit yes; + directory "."; + dump-file "named_dumpdb"; + fake-iquery yes; + files 1000; + has-old-clients no; + heartbeat-interval 30; + host-statistics yes; + host-statistics-max 100; + hostname none; + interface-interval 30; + listen-on port 90 { any; }; + listen-on port 100 { 127.0.0.1; }; + listen-on-v6 port 53 { none; }; + match-mapped-addresses yes; + memstatistics-file "named.memstats"; + multiple-cnames no; + named-xfer "this is no longer needed"; + pid-file none; + port 5300; + querylog yes; + recursing-file "named.recursing"; + random-device "/dev/random"; + recursive-clients 3000; + serial-queries 10; + serial-query-rate 100; + server-id none; +}; diff --git a/bin/tests/system/checkconf/good.conf b/bin/tests/system/checkconf/good.conf new file mode 100644 index 0000000000..aeb30bc4db --- /dev/null +++ b/bin/tests/system/checkconf/good.conf @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and distribute this software for any + * 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: good.conf,v 1.2 2005/06/23 06:52:23 marka Exp $ */ + +/* + * This is just a random selection of configuration options. + */ + +options { + avoid-v4-udp-ports { 100; }; + avoid-v6-udp-ports { 100; }; + blackhole { 10.0.0.0/8; }; + coresize 1G; + datasize 100M; + deallocate-on-exit yes; + directory "."; + dump-file "named_dumpdb"; + fake-iquery yes; + files 1000; + has-old-clients no; + heartbeat-interval 30; + host-statistics yes; + host-statistics-max 100; + hostname none; + interface-interval 30; + listen-on port 90 { any; }; + listen-on port 100 { 127.0.0.1; }; + listen-on-v6 port 53 { none; }; + match-mapped-addresses yes; + memstatistics-file "named.memstats"; + multiple-cnames no; + named-xfer "this is no longer needed"; + pid-file none; + port 5300; + querylog yes; + recursing-file "named.recursing"; + random-device "/dev/random"; + recursive-clients 3000; + serial-queries 10; + serial-query-rate 100; + server-id none; +}; diff --git a/bin/tests/system/checkconf/tests.sh b/bin/tests/system/checkconf/tests.sh new file mode 100644 index 0000000000..b5ebe0891c --- /dev/null +++ b/bin/tests/system/checkconf/tests.sh @@ -0,0 +1,37 @@ +# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC") +# +# Permission to use, copy, modify, and distribute this software for any +# 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.1 2005/06/23 06:52:23 marka Exp $ + +SYSTEMTESTTOP=.. +. $SYSTEMTESTTOP/conf.sh + +status=0 + +echo "I: checking that named-checkconf handles a known good config" + +ret=0 +$CHECKCONF good.conf > /dev/null 2>&1 || ret=1 +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + +echo "I: checking that named-checkconf handles a known bad config" + +ret=1 +$CHECKCONF bad.conf > /dev/null 2>&1 || ret=0 +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + +echo "I:exit status: $status" +exit $status diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index 08f5c9a27f..45b1737699 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -15,7 +15,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: conf.sh.in,v 1.30 2005/06/22 00:10:30 marka Exp $ +# $Id: conf.sh.in,v 1.31 2005/06/23 06:52:22 marka Exp $ # # Common configuration data for system tests, to be sourced into @@ -38,13 +38,14 @@ NSUPDATE=$TOP/bin/nsupdate/nsupdate KEYGEN=$TOP/bin/dnssec/dnssec-keygen SIGNER=$TOP/bin/dnssec/dnssec-signzone CHECKZONE=$TOP/bin/check/named-checkzone +CHECKCONF=$TOP/bin/check/named-checkconf # The "stress" test is not run by default since it creates enough # load on the machine to make it unusable to other users. # v6synth -SUBDIRS="cacheclean checknames dnssec forward glue ixfr limits lwresd \ - masterfile masterformat notify nsupdate resolver sortlist stub tkey \ - unknown upforwd views xfer xferquota zonechecks" +SUBDIRS="cacheclean checkconf checknames dnssec forward glue ixfr limits \ + lwresd masterfile masterformat notify nsupdate resolver sortlist stub \ + tkey unknown upforwd views xfer xferquota zonechecks" # PERL will be an empty string if no perl interpreter was found. PERL=@PERL@ diff --git a/util/copyrights b/util/copyrights index 9a418d0637..652a879037 100644 --- a/util/copyrights +++ b/util/copyrights @@ -421,6 +421,9 @@ ./bin/tests/system/cacheclean/ns2/.cvsignore X 2001 ./bin/tests/system/cacheclean/ns2/named.conf CONF-C 2001,2004 ./bin/tests/system/cacheclean/tests.sh SH 2001,2004 +./bin/tests/system/checkconf/bad.conf CONF-C 2005 +./bin/tests/system/checkconf/good.conf CONF-C 2005 +./bin/tests/system/checkconf/tests.sh SH 2005 ./bin/tests/system/checknames/clean.sh SH 2004 ./bin/tests/system/checknames/ns1/fail.example.db.in ZONE 2004 ./bin/tests/system/checknames/ns1/fail.update.db.in ZONE 2004