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