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

78 lines
1.4 KiB
Plaintext
Raw Normal View History

# $Id: check_common_fn.in,v 1.1 2003/06/08 12:33:38 rocky Exp $
SKIP_TEST_EXITCODE=77
DIFF_OPTS=
have_diff() {
if @DIFF@ ./Makefile ./Makefile > /dev/null 2>&1; then
2003-03-24 19:01:09 +00:00
:
else
return 1;
fi
if @DIFF@ ./Makefile ./check_common_fn.in > /dev/null 2>&1; then
2003-03-24 19:01:09 +00:00
return 1;
fi
# MSDOG output uses \r\n rather than \n in tests
for diff_opt in -w --unified ; do
if @DIFF@ $opt ./Makefile ./Makefile > /dev/null 2>&1; then
DIFF_OPTS="$DIFF_OPTS $diff_opt"
fi
done
2003-03-24 19:01:09 +00:00
return 0;
}
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"
CDINFO="../src/cd-info"
2003-03-24 19:01:09 +00:00
if [ ! -x ${CDINFO} ]; then
echo "$0: No ${CDINFO}"
2003-03-24 19:01:09 +00:00
return 1
fi
if ${CDINFO} --no-header ${opts} >${outfile} 2>&1 ; then
if have_diff; then
if @DIFF@ ${outfile} ${rightfile} ; then
2003-03-24 19:01:09 +00:00
rm -f $outfile
return 0
else
return 3
fi
else
echo "$0: No diff(1) or cmp(1 found - cannot test ${CDINFO}"
2003-03-24 19:01:09 +00:00
rm -f $outfile
return 77
fi
else
echo "$0: ${CDINFO} ${opts} failed"
return 2
fi
}
#;;; Local Variables: ***
#;;; mode:shell-script ***
#;;; eval: (sh-set-shell "bash") ***
#;;; End: ***