1# Tag Image File Format (TIFF) Software
2#
3# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
4#
5# Permission to use, copy, modify, distribute, and sell this software and
6# its documentation for any purpose is hereby granted without fee, provided
7# that (i) the above copyright notices and this permission notice appear in
8# all copies of the software and related documentation, and (ii) the names of
9# Sam Leffler and Silicon Graphics may not be used in any advertising or
10# publicity relating to the software without the specific, prior written
11# permission of Sam Leffler and Silicon Graphics.
12#
13# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16#
17# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
18# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22# OF THIS SOFTWARE.
23
24# Process this file with automake to produce Makefile.in.
25
26AUTOMAKE_OPTIONS = 1.12 color-tests parallel-tests foreign
27
28LIBTIFF = $(top_builddir)/libtiff/libtiff.la
29
30# Environment parameters to be used during tests
31TESTS_ENVIRONMENT = \
32	MAKE="$(MAKE)" \
33	MAKEFLAGS="$(MAKEFLAGS)" \
34	MEMCHECK="$(MEMCHECK)"
35
36EXTRA_DIST = \
37	$(TESTSCRIPTS) \
38	$(IMAGES_EXTRA_DIST) \
39	CMakeLists.txt \
40	common.sh \
41	TiffSplitTest.cmake \
42	TiffTestCommon.cmake \
43	TiffTest.cmake
44
45# All of the tests to execute via 'make check'
46TESTS = $(check_PROGRAMS) $(TESTSCRIPTS)
47
48# Tests which are expected to fail
49XFAIL_TESTS =
50
51# Extra files which should be cleaned by 'make clean'
52CLEANFILES = test_packbits.tif o-*
53
54if HAVE_JPEG
55JPEG_DEPENDENT_CHECK_PROG=raw_decode
56JPEG_DEPENDENT_TESTSCRIPTS=\
57	tiff2rgba-quad-tile.jpg.sh
58else
59JPEG_DEPENDENT_CHECK_PROG=
60JPEG_DEPENDENT_TESTSCRIPTS=
61endif
62
63# Executable programs which need to be built in order to support tests
64check_PROGRAMS = \
65	ascii_tag long_tag short_tag strip_rw rewrite custom_dir \
66	$(JPEG_DEPENDENT_CHECK_PROG)
67
68# Test scripts to execute
69TESTSCRIPTS = \
70	ppm2tiff_pbm.sh \
71	ppm2tiff_pgm.sh \
72	ppm2tiff_ppm.sh \
73	tiffcp-g3.sh \
74	tiffcp-g3-1d.sh \
75	tiffcp-g3-1d-fill.sh \
76	tiffcp-g3-2d.sh \
77	tiffcp-g3-2d-fill.sh \
78	tiffcp-g4.sh \
79	tiffcp-logluv.sh \
80	tiffcp-thumbnail.sh \
81	tiffcp-lzw-compat.sh \
82	tiffdump.sh \
83	tiffinfo.sh \
84	tiffcp-split.sh \
85	tiffcp-split-join.sh \
86	tiff2ps-PS1.sh \
87	tiff2ps-PS2.sh \
88	tiff2ps-PS3.sh \
89	tiff2ps-EPS1.sh \
90	tiff2pdf.sh \
91	tiffcrop-doubleflip-logluv-3c-16b.sh \
92	tiffcrop-doubleflip-minisblack-1c-16b.sh \
93	tiffcrop-doubleflip-minisblack-1c-8b.sh \
94	tiffcrop-doubleflip-minisblack-2c-8b-alpha.sh \
95	tiffcrop-doubleflip-miniswhite-1c-1b.sh \
96	tiffcrop-doubleflip-palette-1c-1b.sh \
97	tiffcrop-doubleflip-palette-1c-4b.sh \
98	tiffcrop-doubleflip-palette-1c-8b.sh \
99	tiffcrop-doubleflip-rgb-3c-16b.sh \
100	tiffcrop-doubleflip-rgb-3c-8b.sh \
101	tiffcrop-extract-logluv-3c-16b.sh \
102	tiffcrop-extract-minisblack-1c-16b.sh \
103	tiffcrop-extract-minisblack-1c-8b.sh \
104	tiffcrop-extract-minisblack-2c-8b-alpha.sh \
105	tiffcrop-extract-miniswhite-1c-1b.sh \
106	tiffcrop-extract-palette-1c-1b.sh \
107	tiffcrop-extract-palette-1c-4b.sh \
108	tiffcrop-extract-palette-1c-8b.sh \
109	tiffcrop-extract-rgb-3c-16b.sh \
110	tiffcrop-extract-rgb-3c-8b.sh \
111	tiffcrop-extractz14-logluv-3c-16b.sh \
112	tiffcrop-extractz14-minisblack-1c-16b.sh \
113	tiffcrop-extractz14-minisblack-1c-8b.sh \
114	tiffcrop-extractz14-minisblack-2c-8b-alpha.sh \
115	tiffcrop-extractz14-miniswhite-1c-1b.sh \
116	tiffcrop-extractz14-palette-1c-1b.sh \
117	tiffcrop-extractz14-palette-1c-4b.sh \
118	tiffcrop-extractz14-palette-1c-8b.sh \
119	tiffcrop-extractz14-rgb-3c-16b.sh \
120	tiffcrop-extractz14-rgb-3c-8b.sh \
121	tiffcrop-R90-logluv-3c-16b.sh \
122	tiffcrop-R90-minisblack-1c-16b.sh \
123	tiffcrop-R90-minisblack-1c-8b.sh \
124	tiffcrop-R90-minisblack-2c-8b-alpha.sh \
125	tiffcrop-R90-miniswhite-1c-1b.sh \
126	tiffcrop-R90-palette-1c-1b.sh \
127	tiffcrop-R90-palette-1c-4b.sh \
128	tiffcrop-R90-palette-1c-8b.sh \
129	tiffcrop-R90-rgb-3c-16b.sh \
130	tiffcrop-R90-rgb-3c-8b.sh \
131	tiff2bw-palette-1c-8b.sh \
132	tiff2bw-quad-lzw-compat.sh \
133	tiff2bw-rgb-3c-8b.sh \
134	tiff2rgba-logluv-3c-16b.sh \
135	tiff2rgba-minisblack-1c-16b.sh \
136	tiff2rgba-minisblack-1c-8b.sh \
137	tiff2rgba-minisblack-2c-8b-alpha.sh \
138	tiff2rgba-miniswhite-1c-1b.sh \
139	tiff2rgba-palette-1c-1b.sh \
140	tiff2rgba-palette-1c-4b.sh \
141	tiff2rgba-palette-1c-8b.sh \
142	tiff2rgba-rgb-3c-16b.sh \
143	tiff2rgba-rgb-3c-8b.sh \
144	$(JPEG_DEPENDENT_TESTSCRIPTS)
145
146# This list should contain all of the TIFF files in the 'images'
147# subdirectory which are intended to be used as input images for
148# tests.  All of these files should use the extension ".tiff".
149TIFFIMAGES = \
150	images/logluv-3c-16b.tiff \
151	images/minisblack-1c-16b.tiff \
152	images/minisblack-1c-8b.tiff \
153	images/minisblack-2c-8b-alpha.tiff \
154	images/miniswhite-1c-1b.tiff \
155	images/palette-1c-1b.tiff \
156	images/palette-1c-4b.tiff \
157	images/palette-1c-8b.tiff \
158	images/rgb-3c-16b.tiff \
159	images/rgb-3c-8b.tiff \
160	images/quad-tile.jpg.tiff \
161	images/quad-lzw-compat.tiff
162
163PNMIMAGES = \
164	images/minisblack-1c-8b.pgm \
165	images/miniswhite-1c-1b.pbm \
166	images/rgb-3c-8b.ppm
167
168# This list should include all of the files in the 'images'
169# subdirectory which are intended to be distributed.  This may include
170# files which are not currently used by the tests.
171IMAGES_EXTRA_DIST = \
172	images/README.txt \
173	$(PNMIMAGES) \
174	$(TIFFIMAGES)
175
176noinst_HEADERS = tifftest.h
177
178ascii_tag_SOURCES = ascii_tag.c
179ascii_tag_LDADD = $(LIBTIFF)
180long_tag_SOURCES = long_tag.c check_tag.c
181long_tag_LDADD = $(LIBTIFF)
182short_tag_SOURCES = short_tag.c check_tag.c
183short_tag_LDADD = $(LIBTIFF)
184strip_rw_SOURCES = strip_rw.c strip.c test_arrays.c test_arrays.h
185strip_rw_LDADD = $(LIBTIFF)
186rewrite_SOURCES = rewrite_tag.c
187rewrite_LDADD = $(LIBTIFF)
188raw_decode_SOURCES = raw_decode.c
189raw_decode_LDADD = $(LIBTIFF)
190custom_dir_SOURCES = custom_dir.c
191custom_dir_LDADD = $(LIBTIFF)
192
193AM_CPPFLAGS = -I$(top_srcdir)/libtiff
194
195# memcheck: valgrind's memory access checker.
196#
197# The suppressions which come with valgrind are sometimes insufficient
198# to handle certain system library aspects which may be reported and
199# which are unrelated to libtiff.  When first starting with a new
200# system (or after a major system update), it is good to execute the
201# test suite (known to already be passing!) like 'make memcheck
202# VALGRIND_EXTRA_OPTS=--gen-suppressions=all' to create valgrind
203# suppression entries in the test log.  Make sure that none of the
204# suppressions are due to libtiff itself.  Tell valgrind about the
205# suppressions by creating a .valgrindrc file with content like:
206# --memcheck:suppressions=mysupp.supp
207memcheck:
208	$(MAKE) MEMCHECK='valgrind --tool=memcheck --leak-check=full --read-var-info=yes \
209	--error-exitcode=2 --track-origins=yes --num-callers=12 \
210	--quiet $(VALGRIND_EXTRA_OPTS)' check
211
212# ptrcheck: valgrind's experimental pointer checking tool.
213ptrcheck:
214	$(MAKE) MEMCHECK='valgrind --tool=exp-ptrcheck --quiet $(VALGRIND_EXTRA_OPTS)' check
215
216# tiff2bw is pretty lame so currently only the generated scripts
217# tiff2bw-palette-1c-8b.sh, tiff2bw-quad-lzw-compat.sh, and
218# tiff2bw-rgb-3c-8b.sh pass tests.
219generate-tiff2bw-tests:
220	for file in $(TIFFIMAGES) ; \
221	do \
222	base=`basename $$file .tiff` ; \
223	testscript=$(srcdir)/tiff2bw-$$base.sh ; \
224	( \
225	  echo "#!/bin/sh" ; \
226	  echo "# Generated file, master is Makefile.am" ; \
227	  echo ". \$${srcdir:-.}/common.sh" ; \
228	  echo "infile=\"\$$srcdir/$$file\"" ; \
229	  echo "outfile=\"o-tiff2bw-$$base.tiff\"" ; \
230	  echo "f_test_convert \"\$$TIFF2BW\" \$$infile \$$outfile" ; \
231	  echo "f_tiffinfo_validate \$$outfile" ; \
232	) > $$testscript ; \
233	chmod +x $$testscript ; \
234	done
235
236generate-tiff2rgba-tests:
237	for file in $(TIFFIMAGES) ; \
238	do \
239	base=`basename $$file .tiff` ; \
240	testscript=$(srcdir)/tiff2rgba-$$base.sh ; \
241	( \
242	  echo "#!/bin/sh" ; \
243	  echo "# Generated file, master is Makefile.am" ; \
244	  echo ". \$${srcdir:-.}/common.sh" ; \
245	  echo "infile=\"\$$srcdir/$$file\"" ; \
246	  echo "outfile=\"o-tiff2rgba-$$base.tiff\"" ; \
247	  echo "f_test_convert \"\$$TIFF2RGBA\" \$$infile \$$outfile" ; \
248	  echo "f_tiffinfo_validate \$$outfile" ; \
249	) > $$testscript ; \
250	chmod +x $$testscript ; \
251	done
252
253# Test rotations
254generate-tiffcrop-R90-tests:
255	for file in $(TIFFIMAGES) ; \
256	do \
257	base=`basename $$file .tiff` ; \
258	testscript=$(srcdir)/tiffcrop-R90-$$base.sh ; \
259	( \
260	  echo "#!/bin/sh" ; \
261	  echo "# Generated file, master is Makefile.am" ; \
262	  echo ". \$${srcdir:-.}/common.sh" ; \
263	  echo "infile=\"\$$srcdir/$$file\"" ; \
264	  echo "outfile=\"o-tiffcrop-R90-$$base.tiff\"" ; \
265	  echo "f_test_convert \"\$$TIFFCROP -R90\" \$$infile \$$outfile" ; \
266	  echo "f_tiffinfo_validate \$$outfile" ; \
267	) > $$testscript ; \
268	chmod +x $$testscript ; \
269	done
270
271# Test flip (mirror)
272generate-tiffcrop-doubleflip-tests:
273	for file in $(TIFFIMAGES) ; \
274	do \
275	base=`basename $$file .tiff` ; \
276	testscript=$(srcdir)/tiffcrop-doubleflip-$$base.sh ; \
277	( \
278	  echo "#!/bin/sh" ; \
279	  echo "# Generated file, master is Makefile.am" ; \
280	  echo ". \$${srcdir:-.}/common.sh" ; \
281	  echo "infile=\"\$$srcdir/$$file\"" ; \
282	  echo "outfile=\"o-tiffcrop-doubleflip-$$base.tiff\"" ; \
283	  echo "f_test_convert \"\$$TIFFCROP -F both\" \$$infile \$$outfile" ; \
284	  echo "f_tiffinfo_validate \$$outfile" ; \
285	) > $$testscript ; \
286	chmod +x $$testscript ; \
287	done
288
289# Test extracting a section 100 pixels wide and 100 pixels high
290generate-tiffcrop-extract-tests:
291	for file in $(TIFFIMAGES) ; \
292	do \
293	base=`basename $$file .tiff` ; \
294	testscript=$(srcdir)/tiffcrop-extract-$$base.sh ; \
295	( \
296	  echo "#!/bin/sh" ; \
297	  echo "# Generated file, master is Makefile.am" ; \
298	  echo ". \$${srcdir:-.}/common.sh" ; \
299	  echo "infile=\"\$$srcdir/$$file\"" ; \
300	  echo "outfile=\"o-tiffcrop-extract-$$base.tiff\"" ; \
301	  echo "f_test_convert \"\$$TIFFCROP -U px -E top -X 60 -Y 60\" \$$infile \$$outfile" ; \
302	  echo "f_tiffinfo_validate \$$outfile" ; \
303	) > $$testscript ; \
304	chmod +x $$testscript ; \
305	done
306
307# Test extracting the first and fourth quarters from the left side.
308generate-tiffcrop-extractz14-tests:
309	for file in $(TIFFIMAGES) ; \
310	do \
311	base=`basename $$file .tiff` ; \
312	testscript=$(srcdir)/tiffcrop-extractz14-$$base.sh ; \
313	( \
314	  echo "#!/bin/sh" ; \
315	  echo "# Generated file, master is Makefile.am" ; \
316	  echo ". \$${srcdir:-.}/common.sh" ; \
317	  echo "infile=\"\$$srcdir/$$file\"" ; \
318	  echo "outfile=\"o-tiffcrop-extractz14-$$base.tiff\"" ; \
319	  echo "f_test_convert \"\$$TIFFCROP -E left -Z1:4,2:4\" \$$infile \$$outfile" ; \
320	  echo "f_tiffinfo_validate \$$outfile" ; \
321	) > $$testscript ; \
322	chmod +x $$testscript ; \
323	done
324
325generate-tiffcrop-tests: \
326	generate-tiffcrop-R90-tests \
327	generate-tiffcrop-doubleflip-tests \
328	generate-tiffcrop-extract-tests \
329	generate-tiffcrop-extractz14-tests
330
331generate-tests: \
332	generate-tiff2bw-tests \
333	generate-tiff2rgba-tests \
334	generate-tiffcrop-tests
335