chiark / gitweb /
@@ -1,10 +1,24 @@
[adns] / regress / r1test
CommitLineData
e3324da1 1#!/bin/sh
2# usage: r1test <testcasename>
89435c42 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.
e3324da1 25
26set -e
ac45858e 27mrc=1
28trap 'exit $mrc' 0
29
a4443336 30casename="$1"
31case="case-$casename"
3c5796f7 32ocase="output-$casename"
e3324da1 33
e9d74277 34exec <"$case.sys"
2d5cce62 35read initfile initflags
e3324da1 36read queryargs
e9d74277 37
38initstring="`cat init-$initfile.text`"
39
3c5796f7 40rm -f $ocase.*
41
8f3b71b0 42EF_DISABLE_BANNER=1
43export EF_DISABLE_BANNER
44
e9d74277 45set +e
3c5796f7 46ADNS_TEST_REPORT_FD=3 3>>"$ocase.report" >"$ocase.out" 2>"$ocase.err" \
2d5cce62 47 ./hplayback $initflags "/$initstring" $queryargs
e9d74277 48rc=$?
49set -e
50
ac45858e 51if [ "$rc" = 5 ]
52then
cc0f95d0 53 printf "SKIPPED-$casename "
ac45858e 54 mrc=5
55 exit
56fi
57
7ca1d685 58echo "rc=$rc" >>$ocase.out
e9d74277 59
09a06b84 60failed=false
61for part in err out
e9d74277 62do
7ca1d685 63 if diff -u -- "$case.$part" "$ocase.$part"
e9d74277 64 then
65 :
66 else
8744cce8 67 failwhy="$failwhy WRONG OUTPUT"
e9d74277 68 fi
69done
70
8744cce8 71cat >"$ocase.leftover"
72if egrep . /dev/null "$ocase.leftover"
09a06b84 73then
8744cce8 74 failwhy="$failwhy EXITED EARLY"
75fi
76
77if [ "x$failwhy" != x ]
78then
79 scremain="`wc -l <\"$ocase.leftover\"`"
80 echo >&2 "FAILED $case -$failwhy - lines of syscall remaining $scremain"
ac45858e 81 mrc=2
82 exit
09a06b84 83fi
84
cc0f95d0 85printf "$casename "
ac45858e 86mrc=0