|
kusano |
7d535a |
# Common code fragment for tests
|
|
kusano |
7d535a |
#
|
|
kusano |
7d535a |
srcdir=${srcdir:-.}
|
|
kusano |
7d535a |
BUILDDIR=`pwd`
|
|
kusano |
7d535a |
SRCDIR=`dirname $0`
|
|
kusano |
7d535a |
SRCDIR=`cd $SRCDIR && pwd`
|
|
kusano |
7d535a |
TOPSRCDIR=`cd $srcdir/.. && pwd`
|
|
kusano |
7d535a |
TOOLS=`cd ../tools && pwd`
|
|
kusano |
7d535a |
IMAGES="${SRCDIR}/images"
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
# Aliases for built tools
|
|
kusano |
7d535a |
BMP2TIFF=${TOOLS}/bmp2tiff
|
|
kusano |
7d535a |
FAX2PS=${TOOLS}/fax2ps
|
|
kusano |
7d535a |
FAX2TIFF=${TOOLS}/fax2tiff
|
|
kusano |
7d535a |
GIF2TIFF=${TOOLS}/gif2tiff
|
|
kusano |
7d535a |
PAL2RGB=${TOOLS}/pal2rgb
|
|
kusano |
7d535a |
PPM2TIFF=${TOOLS}/ppm2tiff
|
|
kusano |
7d535a |
RAS2TIFF=${TOOLS}/ras2tiff
|
|
kusano |
7d535a |
RAW2TIFF=${TOOLS}/raw2tiff
|
|
kusano |
7d535a |
RGB2YCBCR=${TOOLS}/rgb2ycbcr
|
|
kusano |
7d535a |
THUMBNAIL=${TOOLS}/thumbnail
|
|
kusano |
7d535a |
TIFF2BW=${TOOLS}/tiff2bw
|
|
kusano |
7d535a |
TIFF2PDF=${TOOLS}/tiff2pdf
|
|
kusano |
7d535a |
TIFF2PS=${TOOLS}/tiff2ps
|
|
kusano |
7d535a |
TIFF2RGBA=${TOOLS}/tiff2rgba
|
|
kusano |
7d535a |
TIFFCMP=${TOOLS}/tiffcmp
|
|
kusano |
7d535a |
TIFFCP=${TOOLS}/tiffcp
|
|
kusano |
7d535a |
TIFFCROP=${TOOLS}/tiffcrop
|
|
kusano |
7d535a |
TIFFDITHER=${TOOLS}/tiffdither
|
|
kusano |
7d535a |
TIFFDUMP=${TOOLS}/tiffdump
|
|
kusano |
7d535a |
TIFFINFO=${TOOLS}/tiffinfo
|
|
kusano |
7d535a |
TIFFMEDIAN=${TOOLS}/tiffmedian
|
|
kusano |
7d535a |
TIFFSET=${TOOLS}/tiffset
|
|
kusano |
7d535a |
TIFFSPLIT=${TOOLS}/tiffsplit
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
# Aliases for input test files
|
|
kusano |
7d535a |
IMG_MINISBLACK_1C_16B=${IMAGES}/minisblack-1c-16b.tiff
|
|
kusano |
7d535a |
IMG_MINISBLACK_1C_8B=${IMAGES}/minisblack-1c-8b.tiff
|
|
kusano |
7d535a |
IMG_MINISWHITE_1C_1B=${IMAGES}/miniswhite-1c-1b.tiff
|
|
kusano |
7d535a |
IMG_PALETTE_1C_1B=${IMAGES}/palette-1c-1b.tiff
|
|
kusano |
7d535a |
IMG_PALETTE_1C_4B=${IMAGES}/palette-1c-4b.tiff
|
|
kusano |
7d535a |
IMG_PALETTE_1C_8B=${IMAGES}/palette-1c-8b.tiff
|
|
kusano |
7d535a |
IMG_RGB_3C_16B=${IMAGES}/rgb-3c-16b.tiff
|
|
kusano |
7d535a |
IMG_RGB_3C_8B=${IMAGES}/rgb-3c-8b.tiff
|
|
kusano |
7d535a |
IMG_MINISBLACK_2C_8B_ALPHA=${IMAGES}/minisblack-2c-8b-alpha.tiff
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
IMG_PALETTE_1C_8B_BMP=${IMAGES}/palette-1c-8b.bmp
|
|
kusano |
7d535a |
IMG_RGB_3C_8B_BMP=${IMAGES}/rgb-3c-8b.bmp
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
IMG_PALETTE_1C_8B_GIF=${IMAGES}/palette-1c-8b.gif
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
IMG_MINISWHITE_1C_1B_PBM=${IMAGES}/miniswhite-1c-1b.pbm
|
|
kusano |
7d535a |
IMG_MINISBLACK_1C_8B_PGM=${IMAGES}/minisblack-1c-8b.pgm
|
|
kusano |
7d535a |
IMG_RGB_3C_8B_PPM=${IMAGES}/rgb-3c-8b.ppm
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
# All uncompressed image files
|
|
kusano |
7d535a |
IMG_UNCOMPRESSED="${IMG_MINISBLACK_1C_16B} ${IMG_MINISBLACK_1C_8B} ${IMG_MINISWHITE_1C_1B} ${IMG_PALETTE_1C_1B} ${IMG_PALETTE_1C_4B} ${IMG_PALETTE_1C_4B} ${IMG_PALETTE_1C_8B} ${IMG_RGB_3C_8B}"
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#
|
|
kusano |
7d535a |
# Test a simple convert-like command.
|
|
kusano |
7d535a |
#
|
|
kusano |
7d535a |
# f_test_convert command infile outfile
|
|
kusano |
7d535a |
f_test_convert ()
|
|
kusano |
7d535a |
{
|
|
kusano |
7d535a |
command=$1
|
|
kusano |
7d535a |
infile=$2
|
|
kusano |
7d535a |
outfile=$3
|
|
kusano |
7d535a |
rm -f $outfile
|
|
kusano |
7d535a |
echo "$MEMCHECK $command $infile $outfile"
|
|
kusano |
7d535a |
eval $MEMCHECK $command $infile $outfile
|
|
kusano |
7d535a |
status=$?
|
|
kusano |
7d535a |
if [ $status != 0 ] ; then
|
|
kusano |
7d535a |
echo "Returned failed status $status!"
|
|
kusano |
7d535a |
echo "Output (if any) is in \"${outfile}\"."
|
|
kusano |
7d535a |
exit $status
|
|
kusano |
7d535a |
fi
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#
|
|
kusano |
7d535a |
# Test a simple command which sends output to stdout
|
|
kusano |
7d535a |
#
|
|
kusano |
7d535a |
# f_test_stdout command infile outfile
|
|
kusano |
7d535a |
f_test_stdout ()
|
|
kusano |
7d535a |
{
|
|
kusano |
7d535a |
command=$1
|
|
kusano |
7d535a |
infile=$2
|
|
kusano |
7d535a |
outfile=$3
|
|
kusano |
7d535a |
rm -f $outfile
|
|
kusano |
7d535a |
echo "$MEMCHECK $command $infile > $outfile"
|
|
kusano |
7d535a |
eval $MEMCHECK $command $infile > $outfile
|
|
kusano |
7d535a |
status=$?
|
|
kusano |
7d535a |
if [ $status != 0 ] ; then
|
|
kusano |
7d535a |
echo "Returned failed status $status!"
|
|
kusano |
7d535a |
echo "Output (if any) is in \"${outfile}\"."
|
|
kusano |
7d535a |
exit $status
|
|
kusano |
7d535a |
fi
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#
|
|
kusano |
7d535a |
# Execute a simple command (e.g. tiffinfo) with one input file
|
|
kusano |
7d535a |
#
|
|
kusano |
7d535a |
# f_test_exec command infile
|
|
kusano |
7d535a |
f_test_reader ()
|
|
kusano |
7d535a |
{
|
|
kusano |
7d535a |
command=$1
|
|
kusano |
7d535a |
infile=$2
|
|
kusano |
7d535a |
echo "$MEMCHECK $command $infile"
|
|
kusano |
7d535a |
eval $MEMCHECK $command $infile
|
|
kusano |
7d535a |
status=$?
|
|
kusano |
7d535a |
if [ $status != 0 ] ; then
|
|
kusano |
7d535a |
echo "Returned failed status $status!"
|
|
kusano |
7d535a |
exit $status
|
|
kusano |
7d535a |
fi
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#
|
|
kusano |
7d535a |
# Execute tiffinfo on a specified file to validate it
|
|
kusano |
7d535a |
#
|
|
kusano |
7d535a |
# f_tiffinfo_validate infile
|
|
kusano |
7d535a |
f_tiffinfo_validate ()
|
|
kusano |
7d535a |
{
|
|
kusano |
7d535a |
f_test_reader "$TIFFINFO -D" $1
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
if test "$VERBOSE" = TRUE
|
|
kusano |
7d535a |
then
|
|
kusano |
7d535a |
set -x
|
|
kusano |
7d535a |
fi
|
|
kusano |
7d535a |
|