Commit | Line | Data |
---|---|---|
12c5b204 | 1 | #!/bin/sh |
2 | # usage: r1test <testcasename> | |
3d5cde09 | 3 | # test execution script, for running one test |
4 | # | |
ae8cc977 | 5 | # This file is part of adns, which is |
26e1c3d6 | 6 | # Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson |
17cd4f48 | 7 | # Copyright (C) 2014 Mark Wooding |
ae8cc977 | 8 | # Copyright (C) 1999-2000,2003,2006 Tony Finch |
9 | # Copyright (C) 1991 Massachusetts Institute of Technology | |
10 | # (See the file INSTALL for full details.) | |
3d5cde09 | 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 | |
7f8bbe29 | 14 | # the Free Software Foundation; either version 3, or (at your option) |
3d5cde09 | 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 | |
8c09a4c6 | 23 | # along with this program; if not, write to the Free Software Foundation. |
12c5b204 | 24 | |
25 | set -e | |
2dee2b7a | 26 | : ${srcdir=.} |
4ac46883 | 27 | mrc=1 |
28 | trap 'exit $mrc' 0 | |
29 | ||
39196d5f | 30 | casename="$1" |
2dee2b7a | 31 | case="$srcdir/case-$casename" |
98b6d5b4 | 32 | ocase="output-$casename" |
12c5b204 | 33 | |
67a57aae | 34 | exec 4<"$case.sys" |
35 | read <&4 program initfile initflags | |
36 | read <&4 queryargs | |
1c957fda | 37 | |
2dee2b7a MW |
38 | initstring="`cat $srcdir/init-$initfile.text`" |
39 | xinitflagsf=$srcdir/$program-xinitflags.text | |
0ebff22d | 40 | if test -f $xinitflagsf |
41 | then | |
8e26a971 | 42 | initflags="$initflags `cat $xinitflagsf`"; |
0ebff22d | 43 | else |
44 | initflags="$initflags /" | |
45 | fi | |
1c957fda | 46 | |
98b6d5b4 | 47 | rm -f $ocase.* |
48 | ||
1671459c | 49 | EF_DISABLE_BANNER=1 |
50 | export EF_DISABLE_BANNER | |
51 | ||
67a57aae | 52 | if test -f "$case.in" |
53 | then | |
54 | exec <"$case.in" | |
55 | else | |
56 | exec </dev/null | |
57 | fi | |
58 | ||
a069d77f | 59 | playback=./${program}_playback |
60 | if test ! -f $playback | |
61 | then | |
62 | printf "SKIPPED-$casename " | |
63 | mrc=5 | |
64 | exit | |
65 | fi | |
66 | ||
1c957fda | 67 | set +e |
a069d77f | 68 | ADNS_TEST_REPORT_FD=3 ADNS_TEST_IN_FD=4 \ |
e16c09ea | 69 | 3>>"$ocase.report" 4<&4 >"$ocase.out" 2>"$ocase.err" \ |
1da660af | 70 | $ADNS_TEST_DEBUG $playback $initflags"$initstring" $queryargs |
1c957fda | 71 | rc=$? |
72 | set -e | |
73 | ||
4ac46883 | 74 | if [ "$rc" = 5 ] |
75 | then | |
5a0be244 | 76 | printf "SKIPPED-$casename " |
4ac46883 | 77 | mrc=5 |
78 | exit | |
79 | fi | |
80 | ||
78bcc172 | 81 | echo "rc=$rc" >>$ocase.out |
1c957fda | 82 | |
73c4c523 | 83 | failed=false |
84 | for part in err out | |
1c957fda | 85 | do |
78bcc172 | 86 | if diff -u -- "$case.$part" "$ocase.$part" |
1c957fda | 87 | then |
88 | : | |
89 | else | |
4fad263d | 90 | failwhy="$failwhy WRONG OUTPUT" |
1c957fda | 91 | fi |
92 | done | |
93 | ||
a069d77f | 94 | cat <&4 >"$ocase.leftover" |
4fad263d | 95 | if egrep . /dev/null "$ocase.leftover" |
73c4c523 | 96 | then |
4fad263d | 97 | failwhy="$failwhy EXITED EARLY" |
98 | fi | |
99 | ||
100 | if [ "x$failwhy" != x ] | |
101 | then | |
102 | scremain="`wc -l <\"$ocase.leftover\"`" | |
103 | echo >&2 "FAILED $case -$failwhy - lines of syscall remaining $scremain" | |
4ac46883 | 104 | mrc=2 |
105 | exit | |
73c4c523 | 106 | fi |
107 | ||
5a0be244 | 108 | printf "$casename " |
4ac46883 | 109 | mrc=0 |