update copyright dates
[adns] / regress / r1test
CommitLineData
e3324da1 1#!/bin/sh
2# usage: r1test <testcasename>
89435c42 3# test execution script, for running one test
4#
39f45e7e 5# This file is part of adns, which is
6# Copyright (C) 1997-2000,2003,2006 Ian Jackson
7# Copyright (C) 1999-2000,2003,2006 Tony Finch
8# Copyright (C) 1991 Massachusetts Institute of Technology
9# (See the file INSTALL for full details.)
89435c42 10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2, or (at your option)
14# any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software Foundation,
23# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
e3324da1 24
25set -e
ac45858e 26mrc=1
27trap 'exit $mrc' 0
28
a4443336 29casename="$1"
30case="case-$casename"
3c5796f7 31ocase="output-$casename"
e3324da1 32
d024926c 33exec 4<"$case.sys"
34read <&4 program initfile initflags
35read <&4 queryargs
e9d74277 36
37initstring="`cat init-$initfile.text`"
09aee00b 38xinitflagsf=$program-xinitflags.text
39if test -f $xinitflagsf
40then
49972772 41 initflags="$initflags `cat $xinitflagsf`";
09aee00b 42else
43 initflags="$initflags /"
44fi
e9d74277 45
3c5796f7 46rm -f $ocase.*
47
8f3b71b0 48EF_DISABLE_BANNER=1
49export EF_DISABLE_BANNER
50
d024926c 51if test -f "$case.in"
52then
53 exec <"$case.in"
54else
55 exec </dev/null
56fi
57
4b30caad 58playback=./${program}_playback
59if test ! -f $playback
60then
61 printf "SKIPPED-$casename "
62 mrc=5
63 exit
64fi
65
e9d74277 66set +e
4b30caad 67ADNS_TEST_REPORT_FD=3 ADNS_TEST_IN_FD=4 \
f9d56257 68 3>>"$ocase.report" 4<&4 >"$ocase.out" 2>"$ocase.err" \
4b30caad 69 $playback $initflags"$initstring" $queryargs
e9d74277 70rc=$?
71set -e
72
ac45858e 73if [ "$rc" = 5 ]
74then
cc0f95d0 75 printf "SKIPPED-$casename "
ac45858e 76 mrc=5
77 exit
78fi
79
7ca1d685 80echo "rc=$rc" >>$ocase.out
e9d74277 81
09a06b84 82failed=false
83for part in err out
e9d74277 84do
7ca1d685 85 if diff -u -- "$case.$part" "$ocase.$part"
e9d74277 86 then
87 :
88 else
8744cce8 89 failwhy="$failwhy WRONG OUTPUT"
e9d74277 90 fi
91done
92
4b30caad 93cat <&4 >"$ocase.leftover"
8744cce8 94if egrep . /dev/null "$ocase.leftover"
09a06b84 95then
8744cce8 96 failwhy="$failwhy EXITED EARLY"
97fi
98
99if [ "x$failwhy" != x ]
100then
101 scremain="`wc -l <\"$ocase.leftover\"`"
102 echo >&2 "FAILED $case -$failwhy - lines of syscall remaining $scremain"
ac45858e 103 mrc=2
104 exit
09a06b84 105fi
106
cc0f95d0 107printf "$casename "
ac45858e 108mrc=0