1# Common code fragment for tests 2# 3srcdir=${srcdir:-.} 4BUILDDIR=`pwd` 5SRCDIR=`dirname $0` 6SRCDIR=`cd $SRCDIR && pwd` 7TOPSRCDIR=`cd $srcdir/.. && pwd` 8TOOLS=`cd ../tools && pwd` 9IMAGES="${SRCDIR}/images" 10 11# Aliases for built tools 12FAX2PS=${TOOLS}/fax2ps 13FAX2TIFF=${TOOLS}/fax2tiff 14PAL2RGB=${TOOLS}/pal2rgb 15PPM2TIFF=${TOOLS}/ppm2tiff 16RAW2TIFF=${TOOLS}/raw2tiff 17RGB2YCBCR=${TOOLS}/rgb2ycbcr 18THUMBNAIL=${TOOLS}/thumbnail 19TIFF2BW=${TOOLS}/tiff2bw 20TIFF2PDF=${TOOLS}/tiff2pdf 21TIFF2PS=${TOOLS}/tiff2ps 22TIFF2RGBA=${TOOLS}/tiff2rgba 23TIFFCMP=${TOOLS}/tiffcmp 24TIFFCP=${TOOLS}/tiffcp 25TIFFCROP=${TOOLS}/tiffcrop 26TIFFDITHER=${TOOLS}/tiffdither 27TIFFDUMP=${TOOLS}/tiffdump 28TIFFINFO=${TOOLS}/tiffinfo 29TIFFMEDIAN=${TOOLS}/tiffmedian 30TIFFSET=${TOOLS}/tiffset 31TIFFSPLIT=${TOOLS}/tiffsplit 32 33# Aliases for input test files 34IMG_MINISBLACK_1C_16B=${IMAGES}/minisblack-1c-16b.tiff 35IMG_MINISBLACK_1C_8B=${IMAGES}/minisblack-1c-8b.tiff 36IMG_MINISWHITE_1C_1B=${IMAGES}/miniswhite-1c-1b.tiff 37IMG_PALETTE_1C_1B=${IMAGES}/palette-1c-1b.tiff 38IMG_PALETTE_1C_4B=${IMAGES}/palette-1c-4b.tiff 39IMG_PALETTE_1C_8B=${IMAGES}/palette-1c-8b.tiff 40IMG_RGB_3C_16B=${IMAGES}/rgb-3c-16b.tiff 41IMG_RGB_3C_8B=${IMAGES}/rgb-3c-8b.tiff 42IMG_MINISBLACK_2C_8B_ALPHA=${IMAGES}/minisblack-2c-8b-alpha.tiff 43IMG_QUAD_LZW_COMPAT=${IMAGES}/quad-lzw-compat.tiff 44 45IMG_MINISWHITE_1C_1B_PBM=${IMAGES}/miniswhite-1c-1b.pbm 46IMG_MINISBLACK_1C_8B_PGM=${IMAGES}/minisblack-1c-8b.pgm 47IMG_RGB_3C_8B_PPM=${IMAGES}/rgb-3c-8b.ppm 48 49# All uncompressed image files 50IMG_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}" 51 52# 53# Test a simple convert-like command. 54# 55# f_test_convert command infile outfile 56f_test_convert () 57{ 58 command=$1 59 infile=$2 60 outfile=$3 61 rm -f $outfile 62 echo "$MEMCHECK $command $infile $outfile" 63 eval $MEMCHECK $command $infile $outfile 64 status=$? 65 if [ $status != 0 ] ; then 66 echo "Returned failed status $status!" 67 echo "Output (if any) is in \"${outfile}\"." 68 exit $status 69 fi 70} 71 72# 73# Test a simple command which sends output to stdout 74# 75# f_test_stdout command infile outfile 76f_test_stdout () 77{ 78 command=$1 79 infile=$2 80 outfile=$3 81 rm -f $outfile 82 echo "$MEMCHECK $command $infile > $outfile" 83 eval $MEMCHECK $command $infile > $outfile 84 status=$? 85 if [ $status != 0 ] ; then 86 echo "Returned failed status $status!" 87 echo "Output (if any) is in \"${outfile}\"." 88 exit $status 89 fi 90} 91 92# 93# Execute a simple command (e.g. tiffinfo) with one input file 94# 95# f_test_exec command infile 96f_test_reader () 97{ 98 command=$1 99 infile=$2 100 echo "$MEMCHECK $command $infile" 101 eval $MEMCHECK $command $infile 102 status=$? 103 if [ $status != 0 ] ; then 104 echo "Returned failed status $status!" 105 exit $status 106 fi 107} 108 109# 110# Execute tiffinfo on a specified file to validate it 111# 112# f_tiffinfo_validate infile 113f_tiffinfo_validate () 114{ 115 f_test_reader "$TIFFINFO -D" $1 116} 117 118if test "$VERBOSE" = TRUE 119then 120 set -x 121fi 122 123