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 | |
26 | set -e |
4ac46883 |
27 | mrc=1 |
28 | trap 'exit $mrc' 0 |
29 | |
39196d5f |
30 | casename="$1" |
31 | case="case-$casename" |
98b6d5b4 |
32 | ocase="output-$casename" |
12c5b204 |
33 | |
1c957fda |
34 | exec <"$case.sys" |
8b1171e6 |
35 | read initfile initflags |
12c5b204 |
36 | read queryargs |
1c957fda |
37 | |
38 | initstring="`cat init-$initfile.text`" |
39 | |
98b6d5b4 |
40 | rm -f $ocase.* |
41 | |
1671459c |
42 | EF_DISABLE_BANNER=1 |
43 | export EF_DISABLE_BANNER |
44 | |
1c957fda |
45 | set +e |
98b6d5b4 |
46 | ADNS_TEST_REPORT_FD=3 3>>"$ocase.report" >"$ocase.out" 2>"$ocase.err" \ |
8b1171e6 |
47 | ./hplayback $initflags "/$initstring" $queryargs |
1c957fda |
48 | rc=$? |
49 | set -e |
50 | |
4ac46883 |
51 | if [ "$rc" = 5 ] |
52 | then |
5a0be244 |
53 | printf "SKIPPED-$casename " |
4ac46883 |
54 | mrc=5 |
55 | exit |
56 | fi |
57 | |
78bcc172 |
58 | echo "rc=$rc" >>$ocase.out |
1c957fda |
59 | |
73c4c523 |
60 | failed=false |
61 | for part in err out |
1c957fda |
62 | do |
78bcc172 |
63 | if diff -u -- "$case.$part" "$ocase.$part" |
1c957fda |
64 | then |
65 | : |
66 | else |
4fad263d |
67 | failwhy="$failwhy WRONG OUTPUT" |
1c957fda |
68 | fi |
69 | done |
70 | |
4fad263d |
71 | cat >"$ocase.leftover" |
72 | if egrep . /dev/null "$ocase.leftover" |
73c4c523 |
73 | then |
4fad263d |
74 | failwhy="$failwhy EXITED EARLY" |
75 | fi |
76 | |
77 | if [ "x$failwhy" != x ] |
78 | then |
79 | scremain="`wc -l <\"$ocase.leftover\"`" |
80 | echo >&2 "FAILED $case -$failwhy - lines of syscall remaining $scremain" |
4ac46883 |
81 | mrc=2 |
82 | exit |
73c4c523 |
83 | fi |
84 | |
5a0be244 |
85 | printf "$casename " |
4ac46883 |
86 | mrc=0 |