Skip to content

Commit 63e03eb

Browse files
tiffcrop.sh into a collection of many specific tests. Re-wrote
all of the existing tests to be based on some simple shell functions. Make distcheck works again.
1 parent 3237e5e commit 63e03eb

File tree

72 files changed

+420
-362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+420
-362
lines changed

ChangeLog

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
2009-08-23 Bob Friesenhahn <[email protected]>
22

33
* test/Makefile.am, test/tiffcrop*.sh: Split previously existing
4-
tiffcrop.sh into a collection of many specific tests.
4+
tiffcrop.sh into a collection of many specific tests. Re-wrote
5+
all of the existing tests to be based on some simple shell
6+
functions. Make distcheck works again.
57

68
2009-08-21 Bob Friesenhahn <[email protected]>
79

test/Makefile.am

+50-8
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ XFAIL_TESTS = \
4343
tiffcrop-R90-minisblack-2c-8b-alpha.sh
4444

4545
# Extra files which should be cleaned by 'make clean'
46-
CLEANFILES = test_packbits.tif deleteme*
46+
CLEANFILES = test_packbits.tif o-*
4747

4848
# Executable programs which need to be built in order to support tests
4949
check_PROGRAMS = ascii_tag long_tag short_tag strip_rw rewrite
@@ -107,7 +107,16 @@ TESTSCRIPTS = \
107107
tiffcrop-R90-palette-1c-8b.sh \
108108
tiffcrop-R90-rgb-3c-16b.sh \
109109
tiffcrop-R90-rgb-3c-8b.sh \
110-
tiff2rgba.sh
110+
tiff2rgba-logluv-3c-16b.sh \
111+
tiff2rgba-minisblack-1c-16b.sh \
112+
tiff2rgba-minisblack-1c-8b.sh \
113+
tiff2rgba-minisblack-2c-8b-alpha.sh \
114+
tiff2rgba-miniswhite-1c-1b.sh \
115+
tiff2rgba-palette-1c-1b.sh \
116+
tiff2rgba-palette-1c-4b.sh \
117+
tiff2rgba-palette-1c-8b.sh \
118+
tiff2rgba-rgb-3c-16b.sh \
119+
tiff2rgba-rgb-3c-8b.sh
111120

112121
# This list should contain all of the TIFF files in the 'images'
113122
# subdirectory which are intended to be used as input images for
@@ -125,7 +134,8 @@ TIFFIMAGES = \
125134
images/rgb-3c-8b.tiff
126135

127136
# This list should include all of the files in the 'images'
128-
# subdirectory which are intended to be distributed.
137+
# subdirectory which are intended to be distributed. This may include
138+
# files which are not currently used by the tests.
129139
IMAGES_EXTRA_DIST = \
130140
images/README.txt \
131141
$(TIFFIMAGES)
@@ -145,6 +155,22 @@ rewrite_LDADD = $(LIBTIFF)
145155

146156
INCLUDES = -I$(top_srcdir)/libtiff
147157

158+
generate-tiff2rgba-tests:
159+
for file in $(TIFFIMAGES) ; \
160+
do \
161+
base=`basename $$file .tiff` ; \
162+
testscript=$(srcdir)/tiff2rgba-$$base.sh ; \
163+
( \
164+
echo "#!/bin/sh" ; \
165+
echo ". \$${srcdir:-.}/common.sh" ; \
166+
echo "infile=\"$$srcdir/$$file\"" ; \
167+
echo "outfile=\"o-tiff2rgba-$$base.tiff\"" ; \
168+
echo "f_test_convert \"\$$TIFF2RGBA\" \$$infile \$$outfile" ; \
169+
echo "f_tiffinfo_validate \$$outfile" ; \
170+
) > $$testscript ; \
171+
chmod +x $$testscript ; \
172+
done
173+
148174
# Test rotations
149175
generate-tiffcrop-R90-tests:
150176
for file in $(TIFFIMAGES) ; \
@@ -154,7 +180,10 @@ generate-tiffcrop-R90-tests:
154180
( \
155181
echo "#!/bin/sh" ; \
156182
echo ". \$${srcdir:-.}/common.sh" ; \
157-
echo "f_test_convert \"\$$TIFFCROP -R90\" \"\$$srcdir/$$file\" \"deleteme-tiffcrop-R90-$$base.tiff\"" ; \
183+
echo "infile=\"\$$srcdir/$$file\"" ; \
184+
echo "outfile=\"o-tiffcrop-R90-$$base.tiff\"" ; \
185+
echo "f_test_convert \"\$$TIFFCROP -R90\" \$$infile \$$outfile" ; \
186+
echo "f_tiffinfo_validate \$$outfile" ; \
158187
) > $$testscript ; \
159188
chmod +x $$testscript ; \
160189
done
@@ -168,7 +197,10 @@ generate-tiffcrop-doubleflip-tests:
168197
( \
169198
echo "#!/bin/sh" ; \
170199
echo ". \$${srcdir:-.}/common.sh" ; \
171-
echo "f_test_convert \"\$$TIFFCROP -F both\" \"\$$srcdir/$$file\" \"deleteme-tiffcrop-doubleflip-$$base.tiff\"" ; \
200+
echo "infile=\"\$$srcdir/$$file\"" ; \
201+
echo "outfile=\"o-tiffcrop-doubleflip-$$base.tiff\"" ; \
202+
echo "f_test_convert \"\$$TIFFCROP -F both\" \$$infile \$$outfile" ; \
203+
echo "f_tiffinfo_validate \$$outfile" ; \
172204
) > $$testscript ; \
173205
chmod +x $$testscript ; \
174206
done
@@ -182,7 +214,10 @@ generate-tiffcrop-extract-tests:
182214
( \
183215
echo "#!/bin/sh" ; \
184216
echo ". \$${srcdir:-.}/common.sh" ; \
185-
echo "f_test_convert \"\$$TIFFCROP -U px -E top -X 100 -Y 100\" \"\$$srcdir/$$file\" \"deleteme-tiffcrop-extract-$$base.tiff\"" ; \
217+
echo "infile=\"\$$srcdir/$$file\"" ; \
218+
echo "outfile=\"o-tiffcrop-extract-$$base.tiff\"" ; \
219+
echo "f_test_convert \"\$$TIFFCROP -U px -E top -X 100 -Y 100\" \$$infile \$$outfile" ; \
220+
echo "f_tiffinfo_validate \$$outfile" ; \
186221
) > $$testscript ; \
187222
chmod +x $$testscript ; \
188223
done
@@ -196,7 +231,10 @@ generate-tiffcrop-extractz14-tests:
196231
( \
197232
echo "#!/bin/sh" ; \
198233
echo ". \$${srcdir:-.}/common.sh" ; \
199-
echo "f_test_convert \"\$$TIFFCROP -E left -Z1:4,2:4\" \"\$$srcdir/$$file\" \"deleteme-tiffcrop-extractz14-$$base.tiff\"" ; \
234+
echo "infile=\"\$$srcdir/$$file\"" ; \
235+
echo "outfile=\"o-tiffcrop-extractz14-$$base.tiff\"" ; \
236+
echo "f_test_convert \"\$$TIFFCROP -E left -Z1:4,2:4\" \$$infile \$$outfile" ; \
237+
echo "f_tiffinfo_validate \$$outfile" ; \
200238
) > $$testscript ; \
201239
chmod +x $$testscript ; \
202240
done
@@ -205,4 +243,8 @@ generate-tiffcrop-tests: \
205243
generate-tiffcrop-R90-tests \
206244
generate-tiffcrop-doubleflip-tests \
207245
generate-tiffcrop-extract-tests \
208-
generate-tiffcrop-extractz14-tests
246+
generate-tiffcrop-extractz14-tests
247+
248+
generate-tests: \
249+
generate-tiff2rgba-tests \
250+
generate-tiffcrop-tests

test/Makefile.in

+69-9
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ XFAIL_TESTS = \
383383

384384

385385
# Extra files which should be cleaned by 'make clean'
386-
CLEANFILES = test_packbits.tif deleteme*
386+
CLEANFILES = test_packbits.tif o-*
387387

388388
# Test scripts to execute
389389
TESTSCRIPTS = \
@@ -444,7 +444,16 @@ TESTSCRIPTS = \
444444
tiffcrop-R90-palette-1c-8b.sh \
445445
tiffcrop-R90-rgb-3c-16b.sh \
446446
tiffcrop-R90-rgb-3c-8b.sh \
447-
tiff2rgba.sh
447+
tiff2rgba-logluv-3c-16b.sh \
448+
tiff2rgba-minisblack-1c-16b.sh \
449+
tiff2rgba-minisblack-1c-8b.sh \
450+
tiff2rgba-minisblack-2c-8b-alpha.sh \
451+
tiff2rgba-miniswhite-1c-1b.sh \
452+
tiff2rgba-palette-1c-1b.sh \
453+
tiff2rgba-palette-1c-4b.sh \
454+
tiff2rgba-palette-1c-8b.sh \
455+
tiff2rgba-rgb-3c-16b.sh \
456+
tiff2rgba-rgb-3c-8b.sh
448457

449458

450459
# This list should contain all of the TIFF files in the 'images'
@@ -464,7 +473,8 @@ TIFFIMAGES = \
464473

465474

466475
# This list should include all of the files in the 'images'
467-
# subdirectory which are intended to be distributed.
476+
# subdirectory which are intended to be distributed. This may include
477+
# files which are not currently used by the tests.
468478
IMAGES_EXTRA_DIST = \
469479
images/README.txt \
470480
$(TIFFIMAGES)
@@ -912,8 +922,26 @@ tiffcrop-R90-rgb-3c-16b.sh.log: tiffcrop-R90-rgb-3c-16b.sh
912922
@p='tiffcrop-R90-rgb-3c-16b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
913923
tiffcrop-R90-rgb-3c-8b.sh.log: tiffcrop-R90-rgb-3c-8b.sh
914924
@p='tiffcrop-R90-rgb-3c-8b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
915-
tiff2rgba.sh.log: tiff2rgba.sh
916-
@p='tiff2rgba.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
925+
tiff2rgba-logluv-3c-16b.sh.log: tiff2rgba-logluv-3c-16b.sh
926+
@p='tiff2rgba-logluv-3c-16b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
927+
tiff2rgba-minisblack-1c-16b.sh.log: tiff2rgba-minisblack-1c-16b.sh
928+
@p='tiff2rgba-minisblack-1c-16b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
929+
tiff2rgba-minisblack-1c-8b.sh.log: tiff2rgba-minisblack-1c-8b.sh
930+
@p='tiff2rgba-minisblack-1c-8b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
931+
tiff2rgba-minisblack-2c-8b-alpha.sh.log: tiff2rgba-minisblack-2c-8b-alpha.sh
932+
@p='tiff2rgba-minisblack-2c-8b-alpha.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
933+
tiff2rgba-miniswhite-1c-1b.sh.log: tiff2rgba-miniswhite-1c-1b.sh
934+
@p='tiff2rgba-miniswhite-1c-1b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
935+
tiff2rgba-palette-1c-1b.sh.log: tiff2rgba-palette-1c-1b.sh
936+
@p='tiff2rgba-palette-1c-1b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
937+
tiff2rgba-palette-1c-4b.sh.log: tiff2rgba-palette-1c-4b.sh
938+
@p='tiff2rgba-palette-1c-4b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
939+
tiff2rgba-palette-1c-8b.sh.log: tiff2rgba-palette-1c-8b.sh
940+
@p='tiff2rgba-palette-1c-8b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
941+
tiff2rgba-rgb-3c-16b.sh.log: tiff2rgba-rgb-3c-16b.sh
942+
@p='tiff2rgba-rgb-3c-16b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
943+
tiff2rgba-rgb-3c-8b.sh.log: tiff2rgba-rgb-3c-8b.sh
944+
@p='tiff2rgba-rgb-3c-8b.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
917945
.test.log:
918946
@p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
919947
@[email protected]$(EXEEXT).log:
@@ -1074,6 +1102,22 @@ uninstall-am:
10741102
recheck recheck-html tags uninstall uninstall-am
10751103

10761104

1105+
generate-tiff2rgba-tests:
1106+
for file in $(TIFFIMAGES) ; \
1107+
do \
1108+
base=`basename $$file .tiff` ; \
1109+
testscript=$(srcdir)/tiff2rgba-$$base.sh ; \
1110+
( \
1111+
echo "#!/bin/sh" ; \
1112+
echo ". \$${srcdir:-.}/common.sh" ; \
1113+
echo "infile=\"$$srcdir/$$file\"" ; \
1114+
echo "outfile=\"o-tiff2rgba-$$base.tiff\"" ; \
1115+
echo "f_test_convert \"\$$TIFF2RGBA\" \$$infile \$$outfile" ; \
1116+
echo "f_tiffinfo_validate \$$outfile" ; \
1117+
) > $$testscript ; \
1118+
chmod +x $$testscript ; \
1119+
done
1120+
10771121
# Test rotations
10781122
generate-tiffcrop-R90-tests:
10791123
for file in $(TIFFIMAGES) ; \
@@ -1083,7 +1127,10 @@ generate-tiffcrop-R90-tests:
10831127
( \
10841128
echo "#!/bin/sh" ; \
10851129
echo ". \$${srcdir:-.}/common.sh" ; \
1086-
echo "f_test_convert \"\$$TIFFCROP -R90\" \"\$$srcdir/$$file\" \"deleteme-tiffcrop-R90-$$base.tiff\"" ; \
1130+
echo "infile=\"\$$srcdir/$$file\"" ; \
1131+
echo "outfile=\"o-tiffcrop-R90-$$base.tiff\"" ; \
1132+
echo "f_test_convert \"\$$TIFFCROP -R90\" \$$infile \$$outfile" ; \
1133+
echo "f_tiffinfo_validate \$$outfile" ; \
10871134
) > $$testscript ; \
10881135
chmod +x $$testscript ; \
10891136
done
@@ -1097,7 +1144,10 @@ generate-tiffcrop-doubleflip-tests:
10971144
( \
10981145
echo "#!/bin/sh" ; \
10991146
echo ". \$${srcdir:-.}/common.sh" ; \
1100-
echo "f_test_convert \"\$$TIFFCROP -F both\" \"\$$srcdir/$$file\" \"deleteme-tiffcrop-doubleflip-$$base.tiff\"" ; \
1147+
echo "infile=\"\$$srcdir/$$file\"" ; \
1148+
echo "outfile=\"o-tiffcrop-doubleflip-$$base.tiff\"" ; \
1149+
echo "f_test_convert \"\$$TIFFCROP -F both\" \$$infile \$$outfile" ; \
1150+
echo "f_tiffinfo_validate \$$outfile" ; \
11011151
) > $$testscript ; \
11021152
chmod +x $$testscript ; \
11031153
done
@@ -1111,7 +1161,10 @@ generate-tiffcrop-extract-tests:
11111161
( \
11121162
echo "#!/bin/sh" ; \
11131163
echo ". \$${srcdir:-.}/common.sh" ; \
1114-
echo "f_test_convert \"\$$TIFFCROP -U px -E top -X 100 -Y 100\" \"\$$srcdir/$$file\" \"deleteme-tiffcrop-extract-$$base.tiff\"" ; \
1164+
echo "infile=\"\$$srcdir/$$file\"" ; \
1165+
echo "outfile=\"o-tiffcrop-extract-$$base.tiff\"" ; \
1166+
echo "f_test_convert \"\$$TIFFCROP -U px -E top -X 100 -Y 100\" \$$infile \$$outfile" ; \
1167+
echo "f_tiffinfo_validate \$$outfile" ; \
11151168
) > $$testscript ; \
11161169
chmod +x $$testscript ; \
11171170
done
@@ -1125,7 +1178,10 @@ generate-tiffcrop-extractz14-tests:
11251178
( \
11261179
echo "#!/bin/sh" ; \
11271180
echo ". \$${srcdir:-.}/common.sh" ; \
1128-
echo "f_test_convert \"\$$TIFFCROP -E left -Z1:4,2:4\" \"\$$srcdir/$$file\" \"deleteme-tiffcrop-extractz14-$$base.tiff\"" ; \
1181+
echo "infile=\"\$$srcdir/$$file\"" ; \
1182+
echo "outfile=\"o-tiffcrop-extractz14-$$base.tiff\"" ; \
1183+
echo "f_test_convert \"\$$TIFFCROP -E left -Z1:4,2:4\" \$$infile \$$outfile" ; \
1184+
echo "f_tiffinfo_validate \$$outfile" ; \
11291185
) > $$testscript ; \
11301186
chmod +x $$testscript ; \
11311187
done
@@ -1136,6 +1192,10 @@ generate-tiffcrop-tests: \
11361192
generate-tiffcrop-extract-tests \
11371193
generate-tiffcrop-extractz14-tests
11381194

1195+
generate-tests: \
1196+
generate-tiff2rgba-tests \
1197+
generate-tiffcrop-tests
1198+
11391199
# Tell versions [3.59,3.63) of GNU make to not export all variables.
11401200
# Otherwise a system limit (for SysV at least) may be exceeded.
11411201
.NOEXPORT:

test/common.sh

+28-4
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,38 @@ f_test_convert ()
5858
outfile=$3
5959
rm -f $outfile
6060
eval echo $command $infile $outfile
61-
eval $command $infile $outfile
61+
eval $MEMCHECK $command $infile $outfile
6262
status=$?
6363
if [ $status != 0 ] ; then
6464
echo "Returned failed status $status! Output (if any) is in ${outfile}."
65-
else
66-
rm -f $outfile
65+
exit $status
6766
fi
68-
exit $status
67+
}
68+
69+
#
70+
# Execute a simple command (e.g. tiffinfo) with one input file
71+
#
72+
# f_test_exec command infile
73+
f_test_reader ()
74+
{
75+
command=$1
76+
infile=$2
77+
eval echo $command $infile
78+
eval $MEMCHECK $command $infile
79+
status=$?
80+
if [ $status != 0 ] ; then
81+
echo "Returned failed status $status!"
82+
exit $status
83+
fi
84+
}
85+
86+
#
87+
# Execute tiffinfo on a specified file to validate it
88+
#
89+
# f_tiffinfo_validate infile
90+
f_tiffinfo_validate ()
91+
{
92+
f_test_reader "$TIFFINFO -D" $1
6993
}
7094

7195
if test "$VERBOSE" = TRUE

test/tiff2pdf.sh

+1-15
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,4 @@
33
# Basic sanity check for tiff2pdf
44
#
55
. ${srcdir:-.}/common.sh
6-
outfile=deleteme-$$.pdf
7-
8-
operation=tiff2pdf
9-
${TIFF2PDF} -o $outfile ${IMG_MINISWHITE_1C_1B}
10-
status=$?
11-
12-
if test $status -eq 0
13-
then
14-
rm -f ${outfile}
15-
else
16-
echo "Test failed (${operation} return $status). Please inspect these output files:"
17-
echo " " ${outfile}
18-
fi
19-
20-
exit $status
6+
f_test_convert "${TIFF2PDF}" "${IMG_MINISWHITE_1C_1B}" "> o-tiff2pdf.pdf"

test/tiff2ps-EPS1.sh

+1-15
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,4 @@
33
# Basic sanity check for tiffps with PostScript Level 1 encapsulated output
44
#
55
. ${srcdir:-.}/common.sh
6-
7-
outfile=deleteme-$$.ps
8-
operation=tiff2ps
9-
${TIFF2PS} -a -e -1 ${IMG_MINISWHITE_1C_1B} > $outfile
10-
status=$?
11-
12-
if test $status -eq 0
13-
then
14-
rm -f ${outfile}
15-
else
16-
echo "Test failed (${operation} returns $status). Please inspect these output files:"
17-
echo " " ${outfile}
18-
fi
19-
20-
exit $status
6+
f_test_convert "${TIFF2PS} -a -e -1" "${IMG_MINISWHITE_1C_1B}" "> o-tiff2ps-EPS1.ps"

test/tiff2ps-PS1.sh

+1-14
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,4 @@
33
# Basic sanity check for tiffps with PostScript Level 1 output
44
#
55
. ${srcdir:-.}/common.sh
6-
outfile=deleteme-$$.ps
7-
operation=tiff2ps
8-
${TIFF2PS} -a -1 ${IMG_MINISWHITE_1C_1B} > $outfile
9-
status=$?
10-
11-
if test $status -eq 0
12-
then
13-
rm -f ${outfile}
14-
else
15-
echo "Test failed (${operation} returns ${status}). Please inspect these output files:"
16-
echo " " ${outfile}
17-
fi
18-
19-
exit $status
6+
f_test_convert "${TIFF2PS} -a -1" "${IMG_MINISWHITE_1C_1B}" "> o-tiff2ps-PS1.ps"

0 commit comments

Comments
 (0)