Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / bind / dist / bin / tests / system / run.sh
blob17294cf7a0f481504e0c3d46c9e8c86e03913952
1 #!/bin/sh
3 # Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2000, 2001 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
18 # Id: run.sh,v 1.42 2007/06/19 23:47:00 tbox Exp
21 # Run a system test.
24 SYSTEMTESTTOP=.
25 . $SYSTEMTESTTOP/conf.sh
27 stopservers=true
29 case $1 in
30 --keep) stopservers=false; shift ;;
31 esac
33 test $# -gt 0 || { echo "usage: $0 [--keep] test-directory" >&2; exit 1; }
35 test=$1
36 shift
38 test -d $test || { echo "$0: $test: no such test" >&2; exit 1; }
40 echo "S:$test:`date`" >&2
41 echo "T:$test:1:A" >&2
42 echo "A:System test $test" >&2
44 if [ x$PERL = x ]
45 then
46 echo "I:Perl not available. Skipping test." >&2
47 echo "R:UNTESTED" >&2
48 echo "E:$test:`date`" >&2
49 exit 0;
52 $PERL testsock.pl || {
53 echo "I:Network interface aliases not set up. Skipping test." >&2;
54 echo "R:UNTESTED" >&2;
55 echo "E:$test:`date`" >&2;
56 exit 0;
60 # Check for test-specific prerequisites.
62 test ! -f $test/prereq.sh ||
63 ( cd $test && sh prereq.sh "$@" )
64 then
65 : prereqs ok
66 else
67 echo "I:Prerequisites for $test missing, skipping test." >&2
68 echo "R:UNTESTED" >&2
69 echo "E:$test:`date`" >&2
70 exit 0
73 # Set up any dynamically generated test data
74 if test -f $test/setup.sh
75 then
76 ( cd $test && sh setup.sh "$@" )
79 # Start name servers running
80 $PERL start.pl $test || exit 1
82 # Run the tests
83 ( cd $test ; sh tests.sh )
85 status=$?
87 if $stopservers
88 then
90 else
91 exit $status
94 # Shutdown
95 $PERL stop.pl $test
97 status=`expr $status + $?`
99 if [ $status != 0 ]; then
100 echo "R:FAIL"
101 # Don't clean up - we need the evidence.
102 find . -name core -exec chmod 0644 '{}' \;
103 else
104 echo "R:PASS"
106 # Clean up.
107 if test -f $test/clean.sh
108 then
109 ( cd $test && sh clean.sh "$@" )
113 echo "E:$test:`date`"
115 exit $status