File: check_common_fn

package info (click to toggle)
libcdio 0.78.2%2Bdfsg1-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 11,492 kB
  • ctags: 4,911
  • sloc: ansic: 36,479; sh: 9,268; cpp: 2,554; makefile: 736; perl: 29
file content (186 lines) | stat: -rw-r--r-- 3,969 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# $Id: check_common_fn.in,v 1.11 2005/01/29 14:50:34 rocky Exp $
#
#    Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# Common routines and setup for regression testing.
SKIP_TEST_EXITCODE=77

# Some output changes depending on TZ and locale. Set this so we get known
# results
TZ=CUT
LC_TIME='en_US'
export TZ LC_TIME

check_result() {
  RC=$1
  shift
  msg=$1
  shift
  cmdline=$*
  if test $RC -ne 0 ; then 
    if test $RC -ne $SKIP_TEST_EXITCODE ; then
      echo "$0: $msg failed in comparing output."
      if test -n "$cmdline" ; then 
        echo "$0: failed command:"
        echo "	$cmdline"
      fi
      exit $RC
    else 
      echo "$0: $msg skipped."
    fi
  else 
    echo "$0: $msg ok."
  fi
}

test_cdinfo() {

  opts="$1"
  outfile="$2"
  rightfile="$3"

  CD_INFO="../src/cd-info"

  if [ ! -x ${CD_INFO} ]; then
    echo "$0: No ${CD_INFO}"
    return 1
  fi

  if ${CD_INFO} --no-header ${opts} >${outfile} 2>&1 ; then 
    if test "/usr/bin/diff" != no; then
      if /usr/bin/diff  -w --unified ${outfile} ${rightfile} ; then
	rm -f $outfile
	return 0
      else
	return 3
      fi
    else
      echo "$0: No diff(1) or cmp(1) found - cannot test ${CD_INFO}"
      rm -f $outfile
      return 77
    fi
  else
    echo "$0 failed running: ${CD_INFO} ${opts}"
    return 2
  fi

}

test_iso_info() {

  opts="$1"
  outfile="$2"
  rightfile="$3"

  ISO_INFO="../src/iso-info"

  if [ ! -x ${ISO_INFO} ]; then
    echo "$0: No ${ISO_INFO}"
    return 1
  fi

  cmdline="${ISO_INFO} --no-header ${opts}"
  if $cmdline  >${outfile} 2>&1 ; then 
    if test "/usr/bin/diff" != no; then
      if /usr/bin/diff  -w --unified ${outfile} ${rightfile} ; then
	rm -f $outfile
	return 0
      else
	return 3
      fi
    else
      echo "$0: No diff(1) or cmp(1 found - cannot test ${ISO_INFO}"
      rm -f $outfile
      return 77
    fi
  else
    echo "$0 failed running: $cmdline"
    return 2
  fi

}

test_iso_read() {

  opts="$1"
  outfile="$2"
  rightfile="$3"

  ISO_READ="../src/iso-read"

  if [ ! -x ${ISO_READ} ]; then
    echo "$0: No ${ISO_READ}"
    return 1
  fi

  if ${ISO_READ} ${opts} -o ${outfile} 2>&1 ; then 
    if test "/usr/bin/diff" != no; then
      if /usr/bin/diff  -w --unified ${outfile} ${rightfile} ; then
	rm -f $outfile
	return 0
      else
	return 3
      fi
    else
      echo "$0: No diff(1) or cmp(1 found - cannot test ${ISO_READ}"
      rm -f $outfile
      return 77
    fi
  else
    echo "$0 failed running: ${ISO_READ} ${opts}"
    return 2
  fi

}

test_cd_read() {

  opts="$1"
  outfile="$2"
  rightfile="$3"

  CD_READ="../src/cd-read"

  if [ ! -x ${CD_READ} ]; then
    echo "$0: No ${CD_READ}"
    return 1
  fi

  if ${CD_READ} --no-header ${opts} >${outfile} 2>&1 ; then 
    if test "/usr/bin/diff" != no; then
      if /usr/bin/diff  -w --unified ${outfile} ${rightfile} ; then
	rm -f $outfile
	return 0
      else
	return 3
      fi
    else
      echo "$0: No diff(1) or cmp(1 found - cannot test ${CD_READ}"
      rm -f $outfile
      return 77
    fi
  else
    echo "$0 failed running: ${CD_READ} ${opts}"
    return 2
  fi

}

#;;; Local Variables: ***
#;;; mode:shell-script ***
#;;; eval: (sh-set-shell "bash") ***
#;;; End: ***