This repository has been archived on 2025-05-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
libcdio-osx/test/check_common_fn.in

180 lines
3.6 KiB
Plaintext
Raw Normal View History

2004-03-06 03:51:52 +00:00
# $Id: check_common_fn.in,v 1.7 2004/03/06 03:51:52 rocky Exp $
#
2004-03-06 03:51:52 +00:00
# Copyright (C) 2003, 2004 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
2003-03-24 19:01:09 +00:00
# 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
2003-03-24 19:01:09 +00:00
check_result() {
RC=$1
shift
msg=$*
if test $RC -ne 0 ; then
if test $RC -ne $SKIP_TEST_EXITCODE ; then
2003-03-24 19:01:09 +00:00
echo "$0: $msg failed."
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"
2003-03-24 19:01:09 +00:00
if [ ! -x ${CD_INFO} ]; then
echo "$0: No ${CD_INFO}"
2003-03-24 19:01:09 +00:00
return 1
fi
if ${CD_INFO} --no-header ${opts} >${outfile} 2>&1 ; then
if test "@DIFF@" != no; then
if @DIFF@ @DIFF_OPTS@ ${outfile} ${rightfile} ; then
2003-03-24 19:01:09 +00:00
rm -f $outfile
return 0
else
return 3
fi
else
2004-03-06 03:51:52 +00:00
echo "$0: No diff(1) or cmp(1) found - cannot test ${CD_INFO}"
2003-03-24 19:01:09 +00:00
rm -f $outfile
return 77
fi
else
echo "$0: ${CD_INFO} ${opts} failed"
return 2
fi
}
2004-02-29 15:42:30 +00:00
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
if ${ISO_INFO} --no-header ${opts} >${outfile} 2>&1 ; then
if test "/usr/bin/diff" != no; then
if @DIFF@ @DIFF_OPTS@ ${outfile} ${rightfile} ; then
2004-02-29 15:42:30 +00:00
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: ${ISO_INFO} ${opts} failed"
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 "@DIFF@" != no; then
if @DIFF@ @DIFF_OPTS@ ${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: ${ISO_READ} ${opts} failed"
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} ${opts} >${outfile} 2>&1 ; then
if test "@DIFF@" != no; then
if @DIFF@ @DIFF_OPTS@ ${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: ${CD_READ} ${opts} failed"
2003-03-24 19:01:09 +00:00
return 2
fi
}
#;;; Local Variables: ***
#;;; mode:shell-script ***
#;;; eval: (sh-set-shell "bash") ***
#;;; End: ***