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
|
#!/bin/sh
set -e
# The input file to convert
INFILE=./samples/sample-utf16-le.txt.gz
# The output file of the conversion
OUTFILE=test-utf16-le.txt
# The reference file to compare the output against
CMPFILE=./expected/out-utf16-le.txt
#
# Create temporary directory for test
# output if AUTOPKGTEST_TMP is undefined.
# Debian GNU/Linux defines AUTOPKGTEST_TMP.
#
if [ "x${AUTOPKGTEST_TMP}" = "x" ] ; then
TEST_TMP=$(mktemp -d)
trap "\rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
else
TEST_TMP=${AUTOPKGTEST_TMP}
fi
#
# Point to the source directory for test.
#
if [ "x${srcdir}" = "x" ] ; then
srcdir=.
fi
#
# Point to utf16-le executable; utfcheck_bindir
# should be defined for "make installcheck".
# Otherwise, leave undefined for "make check".
#
if [ "x${utfcheck_bindir}" = "x" ] ; then
utfcheck_bindir=../src
fi
#
# Ignore error exit status so we can keep going and
# compare the utfcheck output with the expected output.
#
( gunzip < ${srcdir}/${INFILE} | \
${utfcheck_bindir}/utfcheck > ${TEST_TMP}/${OUTFILE} ) || true
diff ${srcdir}/${CMPFILE} ${TEST_TMP}/${OUTFILE} || \
(echo "test-utf16-le FAILED; output in ${TEST_TMP}/${OUTFILE}" ; exit 1)
#
# If AUTOPKGTEST_TMP was defined, don't remove it;
# a Debian calling process will take care of that.
#
if [ "x${AUTOPKGTEST_TMP}" = "x" ] ; then
\rm -rf ${TEST_TMP}
fi
|