3 # Copyright (C) 2011-2013 Internet Systems Consortium, Inc. ("ISC")
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.
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.
17 # Id: tests.sh,v 1.4 2011/03/22 16:51:50 smann Exp
20 .
$SYSTEMTESTTOP/conf.sh
23 PLAINCONF
="${THISDIR}/${CONFDIR}/named.plain"
24 DIRCONF
="${THISDIR}/${CONFDIR}/named.dirconf"
25 PIPECONF
="${THISDIR}/${CONFDIR}/named.pipeconf"
26 SYMCONF
="${THISDIR}/${CONFDIR}/named.symconf"
31 PIDFILE
="${THISDIR}/${CONFDIR}/named.pid"
32 myRNDC
="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf"
33 myNAMED
="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -T nosyslog -d 99 -U 4"
39 echo "I:testing log file validity (named -g + only plain files allowed)"
41 # First run with a known good config.
43 cp $PLAINCONF named.conf
45 grep "reloading configuration failed" named.run
> /dev
/null
2>&1
48 echo "I: testing plain file succeeded"
50 echo "I: testing plain file failed (unexpected)"
51 echo "I:exit status: 1"
55 # Now try directory, expect failure
56 echo "I: testing directory as log file (named -g)"
59 mkdir
-p $DIRFILE >/dev
/null
2>&1
62 cp $DIRCONF named.conf
65 grep "checking logging configuration failed: invalid file" named.run
> /dev
/null
2>&1
68 echo "I: testing directory as file succeeded (UNEXPECTED)"
69 echo "I:exit status: 1"
72 echo "I: testing directory as log file failed (expected)"
75 echo "I: skipping directory test (unable to create directory)"
78 # Now try pipe file, expect failure
79 echo "I: testing pipe file as log file (named -g)"
82 mkfifo $PIPEFILE >/dev
/null
2>&1
85 cp $PIPECONF named.conf
88 grep "checking logging configuration failed: invalid file" named.run
> /dev
/null
2>&1
91 echo "I: testing pipe file as log file succeeded (UNEXPECTED)"
92 echo "I:exit status: 1"
95 echo "I: testing pipe file as log file failed (expected)"
98 echo "I: skipping pipe test (unable to create pipe)"
101 # Now try symlink file to plain file, expect success
102 echo "I: testing symlink to plain file as log file (named -g)"
106 rm -f $SYMFILE $SYMFILE
107 ln -s $PLAINFILE $SYMFILE >/dev
/null
2>&1
110 cp $SYMCONF named.conf
113 grep "reloading configuration failed" named.run
> /dev
/null
2>&1
116 echo "I: testing symlink to plain file succeeded"
118 echo "I: testing symlink to plain file failed (unexpected)"
119 echo "I:exit status: 1"
123 echo "I: skipping symlink test (unable to create symlink)"
125 # Stop the server and run through a series of tests with various config
126 # files while controlling the stop/start of the server.
127 # Have to stop the stock server because it uses "-g"
129 $PERL ..
/..
/stop.pl .. ns1
131 $myNAMED > /dev
/null
2>&1
135 echo "I:failed to start $myNAMED"
136 echo "I:exit status: $status"
142 echo "I:testing log file validity (only plain files allowed)"
144 # First run with a known good config.
146 cp $PLAINCONF named.conf
148 grep "reloading configuration failed" named.run
> /dev
/null
2>&1
151 echo "I: testing plain file succeeded"
153 echo "I: testing plain file failed (unexpected)"
154 echo "I:exit status: 1"
158 # Now try directory, expect failure
159 echo "I: testing directory as log file"
162 mkdir
-p $DIRFILE >/dev
/null
2>&1
165 cp $DIRCONF named.conf
168 grep "configuring logging: invalid file" named.run
> /dev
/null
2>&1
171 echo "I: testing directory as file succeeded (UNEXPECTED)"
172 echo "I:exit status: 1"
175 echo "I: testing directory as log file failed (expected)"
178 echo "I: skipping directory test (unable to create directory)"
181 # Now try pipe file, expect failure
182 echo "I: testing pipe file as log file"
185 mkfifo $PIPEFILE >/dev
/null
2>&1
188 cp $PIPECONF named.conf
191 grep "configuring logging: invalid file" named.run
> /dev
/null
2>&1
194 echo "I: testing pipe file as log file succeeded (UNEXPECTED)"
195 echo "I:exit status: 1"
198 echo "I: testing pipe file as log file failed (expected)"
201 echo "I: skipping pipe test (unable to create pipe)"
204 # Now try symlink file to plain file, expect success
205 echo "I: testing symlink to plain file as log file"
211 ln -s $PLAINFILE $SYMFILE >/dev
/null
2>&1
214 cp $SYMCONF named.conf
217 grep "reloading configuration failed" named.run
> /dev
/null
2>&1
220 echo "I: testing symlink to plain file succeeded"
222 echo "I: testing symlink to plain file failed (unexpected)"
223 echo "I:exit status: 1"
227 echo "I: skipping symlink test (unable to create symlink)"
230 echo "I:exit status: $status"