From 003c4211a019eb5c4719860f353777e177553490 Mon Sep 17 00:00:00 2001 From: Chris Liddell Date: Tue, 27 Mar 2018 14:08:47 +0100 Subject: Update libtiff to 4.0.9 Add in portability changes to tiffiop.h Portability tiffiop.h Remove globals from tif_pixarlog.c Tweaks to support libtiff 4.0.9 --- tiff/test/CMakeLists.txt | 34 ++++++++++------ tiff/test/Makefile.am | 31 ++++++++++++++- tiff/test/Makefile.in | 73 ++++++++++++++++++++++++++++++---- tiff/test/TiffTestCommon.cmake | 5 +++ tiff/test/common.sh | 1 + tiff/test/images/quad-lzw-compat.tiff | Bin 0 -> 214342 bytes tiff/test/tiff2bw-palette-1c-8b.sh | 7 ++++ tiff/test/tiff2bw-quad-lzw-compat.sh | 7 ++++ tiff/test/tiff2bw-rgb-3c-8b.sh | 7 ++++ tiff/test/tiffcp-lzw-compat.sh | 6 +++ 10 files changed, 148 insertions(+), 23 deletions(-) create mode 100644 tiff/test/images/quad-lzw-compat.tiff create mode 100755 tiff/test/tiff2bw-palette-1c-8b.sh create mode 100755 tiff/test/tiff2bw-quad-lzw-compat.sh create mode 100755 tiff/test/tiff2bw-rgb-3c-8b.sh create mode 100755 tiff/test/tiffcp-lzw-compat.sh (limited to 'tiff/test') diff --git a/tiff/test/CMakeLists.txt b/tiff/test/CMakeLists.txt index b9e373f96..912be19ca 100644 --- a/tiff/test/CMakeLists.txt +++ b/tiff/test/CMakeLists.txt @@ -43,6 +43,7 @@ set(TESTSCRIPTS tiffcp-g4.sh tiffcp-logluv.sh tiffcp-thumbnail.sh + tiffcp-lzw-compat.sh tiffdump.sh tiffinfo.sh tiffcp-split.sh @@ -118,7 +119,8 @@ set(TIFFIMAGES images/palette-1c-8b.tiff images/rgb-3c-16b.tiff images/rgb-3c-8b.tiff - images/quad-tile.jpg.tiff) + images/quad-tile.jpg.tiff + images/quad-lzw-compat.tiff) set(BMPIMAGES images/palette-1c-8b.bmp @@ -185,6 +187,18 @@ target_link_libraries(custom_dir tiff port) set(TEST_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output") file(MAKE_DIRECTORY "${TEST_OUTPUT}") +set(tiff_test_extra_args + "-DTIFFCP=$" + "-DTIFFINFO=$" + "-DTIFFSPLIT=$" + "-DLIBTIFF=$") +if(WIN32) + list(APPEND tiff_test_extra_args "-DWIN32=${WIN32}") +endif() +if(CYGWIN) + list(APPEND tiff_test_extra_args "-DCYGWIN=${CYGWIN}") +endif() + macro(tiff_test_convert name command1 command2 command3 infile outfile validate) add_test(NAME "${name}" COMMAND "${CMAKE_COMMAND}" @@ -193,9 +207,8 @@ macro(tiff_test_convert name command1 command2 command3 infile outfile validate) "-DCONVERT_COMMAND3=${command3}" "-DINFILE=${infile}" "-DOUTFILE=${outfile}" - "-DTIFFINFO=$" - "-DLIBTIFF=$" "-DVALIDATE=${validate}" + ${tiff_test_extra_args} -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") endmacro() @@ -205,8 +218,7 @@ macro(tiff_test_stdout name command infile outfile) "-DSTDOUT_COMMAND=${command}" "-DINFILE=${infile}" "-DOUTFILE=${outfile}" - "-DTIFFINFO=$" - "-DLIBTIFF=$" + ${tiff_test_extra_args} -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") endmacro() @@ -215,8 +227,7 @@ macro(tiff_test_reader name command infile) COMMAND "${CMAKE_COMMAND}" "-DREADER_COMMAND=${command}" "-DINFILE=${infile}" - "-DTIFFINFO=$" - "-DLIBTIFF=$" + ${tiff_test_extra_args} -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") endmacro() @@ -323,6 +334,7 @@ add_convert_test(tiffcp g31dfill "-c g3:1d:fill" "images/miniswhite-1c-1b.ti add_convert_test(tiffcp g32d "-c g3:2d" "images/miniswhite-1c-1b.tiff" FALSE) add_convert_test(tiffcp g32dfill "-c g3:2d:fill" "images/miniswhite-1c-1b.tiff" FALSE) add_convert_test(tiffcp g4 "-c g4" "images/miniswhite-1c-1b.tiff" FALSE) +add_convert_test(tiffcp none "-c none" "images/quad-lzw-compat.tiff" FALSE) add_convert_test_multi(tiffcp tiffcp "" logluv "-c none" "-c sgilog" "" "images/logluv-3c-16b.tiff" FALSE) add_convert_test_multi(tiffcp thumbnail "" thumbnail "g3:1d" "" "" @@ -344,9 +356,7 @@ add_test(NAME "tiffcp-split" "-DTESTFILES=${ESCAPED_UNCOMPRESSED}" "-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-conjoined.tif" "-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-split-" - "-DTIFFCP=$" - "-DTIFFSPLIT=$" - "-DLIBTIFF=$" + ${tiff_test_extra_args} -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake") add_test(NAME "tiffcp-split-join" COMMAND "${CMAKE_COMMAND}" @@ -354,9 +364,7 @@ add_test(NAME "tiffcp-split-join" "-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-join-conjoined.tif" "-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-join-split-" "-DRECONJOINED=${TEST_OUTPUT}/tiffcp-split-join-reconjoined.tif" - "-DTIFFCP=$" - "-DTIFFSPLIT=$" - "-DLIBTIFF=$" + ${tiff_test_extra_args} -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake") # PDF diff --git a/tiff/test/Makefile.am b/tiff/test/Makefile.am index df5c082d7..2052487ca 100644 --- a/tiff/test/Makefile.am +++ b/tiff/test/Makefile.am @@ -53,7 +53,8 @@ CLEANFILES = test_packbits.tif o-* if HAVE_JPEG JPEG_DEPENDENT_CHECK_PROG=raw_decode -JPEG_DEPENDENT_TESTSCRIPTS=tiff2rgba-quad-tile.jpg.sh +JPEG_DEPENDENT_TESTSCRIPTS=\ + tiff2rgba-quad-tile.jpg.sh else JPEG_DEPENDENT_CHECK_PROG= JPEG_DEPENDENT_TESTSCRIPTS= @@ -77,6 +78,7 @@ TESTSCRIPTS = \ tiffcp-g4.sh \ tiffcp-logluv.sh \ tiffcp-thumbnail.sh \ + tiffcp-lzw-compat.sh \ tiffdump.sh \ tiffinfo.sh \ tiffcp-split.sh \ @@ -126,6 +128,9 @@ TESTSCRIPTS = \ tiffcrop-R90-palette-1c-8b.sh \ tiffcrop-R90-rgb-3c-16b.sh \ tiffcrop-R90-rgb-3c-8b.sh \ + tiff2bw-palette-1c-8b.sh \ + tiff2bw-quad-lzw-compat.sh \ + tiff2bw-rgb-3c-8b.sh \ tiff2rgba-logluv-3c-16b.sh \ tiff2rgba-minisblack-1c-16b.sh \ tiff2rgba-minisblack-1c-8b.sh \ @@ -152,7 +157,8 @@ TIFFIMAGES = \ images/palette-1c-8b.tiff \ images/rgb-3c-16b.tiff \ images/rgb-3c-8b.tiff \ - images/quad-tile.jpg.tiff + images/quad-tile.jpg.tiff \ + images/quad-lzw-compat.tiff PNMIMAGES = \ images/minisblack-1c-8b.pgm \ @@ -207,6 +213,26 @@ memcheck: ptrcheck: $(MAKE) MEMCHECK='valgrind --tool=exp-ptrcheck --quiet $(VALGRIND_EXTRA_OPTS)' check +# tiff2bw is pretty lame so currently only the generated scripts +# tiff2bw-palette-1c-8b.sh, tiff2bw-quad-lzw-compat.sh, and +# tiff2bw-rgb-3c-8b.sh pass tests. +generate-tiff2bw-tests: + for file in $(TIFFIMAGES) ; \ + do \ + base=`basename $$file .tiff` ; \ + testscript=$(srcdir)/tiff2bw-$$base.sh ; \ + ( \ + echo "#!/bin/sh" ; \ + echo "# Generated file, master is Makefile.am" ; \ + echo ". \$${srcdir:-.}/common.sh" ; \ + echo "infile=\"\$$srcdir/$$file\"" ; \ + echo "outfile=\"o-tiff2bw-$$base.tiff\"" ; \ + echo "f_test_convert \"\$$TIFF2BW\" \$$infile \$$outfile" ; \ + echo "f_tiffinfo_validate \$$outfile" ; \ + ) > $$testscript ; \ + chmod +x $$testscript ; \ + done + generate-tiff2rgba-tests: for file in $(TIFFIMAGES) ; \ do \ @@ -303,5 +329,6 @@ generate-tiffcrop-tests: \ generate-tiffcrop-extractz14-tests generate-tests: \ + generate-tiff2bw-tests \ generate-tiff2rgba-tests \ generate-tiffcrop-tests diff --git a/tiff/test/Makefile.in b/tiff/test/Makefile.in index 92a416536..15c0147b1 100644 --- a/tiff/test/Makefile.in +++ b/tiff/test/Makefile.in @@ -413,10 +413,10 @@ AM_RECURSIVE_TARGETS = check recheck am__EXEEXT_3 = ppm2tiff_pbm.sh ppm2tiff_pgm.sh ppm2tiff_ppm.sh \ tiffcp-g3.sh tiffcp-g3-1d.sh tiffcp-g3-1d-fill.sh \ tiffcp-g3-2d.sh tiffcp-g3-2d-fill.sh tiffcp-g4.sh \ - tiffcp-logluv.sh tiffcp-thumbnail.sh tiffdump.sh tiffinfo.sh \ - tiffcp-split.sh tiffcp-split-join.sh tiff2ps-PS1.sh \ - tiff2ps-PS2.sh tiff2ps-PS3.sh tiff2ps-EPS1.sh tiff2pdf.sh \ - tiffcrop-doubleflip-logluv-3c-16b.sh \ + tiffcp-logluv.sh tiffcp-thumbnail.sh tiffcp-lzw-compat.sh \ + tiffdump.sh tiffinfo.sh tiffcp-split.sh tiffcp-split-join.sh \ + tiff2ps-PS1.sh tiff2ps-PS2.sh tiff2ps-PS3.sh tiff2ps-EPS1.sh \ + tiff2pdf.sh tiffcrop-doubleflip-logluv-3c-16b.sh \ tiffcrop-doubleflip-minisblack-1c-16b.sh \ tiffcrop-doubleflip-minisblack-1c-8b.sh \ tiffcrop-doubleflip-minisblack-2c-8b-alpha.sh \ @@ -451,8 +451,9 @@ am__EXEEXT_3 = ppm2tiff_pbm.sh ppm2tiff_pgm.sh ppm2tiff_ppm.sh \ tiffcrop-R90-miniswhite-1c-1b.sh tiffcrop-R90-palette-1c-1b.sh \ tiffcrop-R90-palette-1c-4b.sh tiffcrop-R90-palette-1c-8b.sh \ tiffcrop-R90-rgb-3c-16b.sh tiffcrop-R90-rgb-3c-8b.sh \ - tiff2rgba-logluv-3c-16b.sh tiff2rgba-minisblack-1c-16b.sh \ - tiff2rgba-minisblack-1c-8b.sh \ + tiff2bw-palette-1c-8b.sh tiff2bw-quad-lzw-compat.sh \ + tiff2bw-rgb-3c-8b.sh tiff2rgba-logluv-3c-16b.sh \ + tiff2rgba-minisblack-1c-16b.sh tiff2rgba-minisblack-1c-8b.sh \ tiff2rgba-minisblack-2c-8b-alpha.sh \ tiff2rgba-miniswhite-1c-1b.sh tiff2rgba-palette-1c-1b.sh \ tiff2rgba-palette-1c-4b.sh tiff2rgba-palette-1c-8b.sh \ @@ -653,7 +654,9 @@ CLEANFILES = test_packbits.tif o-* @HAVE_JPEG_FALSE@JPEG_DEPENDENT_CHECK_PROG = @HAVE_JPEG_TRUE@JPEG_DEPENDENT_CHECK_PROG = raw_decode @HAVE_JPEG_FALSE@JPEG_DEPENDENT_TESTSCRIPTS = -@HAVE_JPEG_TRUE@JPEG_DEPENDENT_TESTSCRIPTS = tiff2rgba-quad-tile.jpg.sh +@HAVE_JPEG_TRUE@JPEG_DEPENDENT_TESTSCRIPTS = \ +@HAVE_JPEG_TRUE@ tiff2rgba-quad-tile.jpg.sh + # Test scripts to execute TESTSCRIPTS = \ @@ -668,6 +671,7 @@ TESTSCRIPTS = \ tiffcp-g4.sh \ tiffcp-logluv.sh \ tiffcp-thumbnail.sh \ + tiffcp-lzw-compat.sh \ tiffdump.sh \ tiffinfo.sh \ tiffcp-split.sh \ @@ -717,6 +721,9 @@ TESTSCRIPTS = \ tiffcrop-R90-palette-1c-8b.sh \ tiffcrop-R90-rgb-3c-16b.sh \ tiffcrop-R90-rgb-3c-8b.sh \ + tiff2bw-palette-1c-8b.sh \ + tiff2bw-quad-lzw-compat.sh \ + tiff2bw-rgb-3c-8b.sh \ tiff2rgba-logluv-3c-16b.sh \ tiff2rgba-minisblack-1c-16b.sh \ tiff2rgba-minisblack-1c-8b.sh \ @@ -744,7 +751,8 @@ TIFFIMAGES = \ images/palette-1c-8b.tiff \ images/rgb-3c-16b.tiff \ images/rgb-3c-8b.tiff \ - images/quad-tile.jpg.tiff + images/quad-tile.jpg.tiff \ + images/quad-lzw-compat.tiff PNMIMAGES = \ images/minisblack-1c-8b.pgm \ @@ -1210,6 +1218,13 @@ tiffcp-thumbnail.sh.log: tiffcp-thumbnail.sh --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tiffcp-lzw-compat.sh.log: tiffcp-lzw-compat.sh + @p='tiffcp-lzw-compat.sh'; \ + b='tiffcp-lzw-compat.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tiffdump.sh.log: tiffdump.sh @p='tiffdump.sh'; \ b='tiffdump.sh'; \ @@ -1553,6 +1568,27 @@ tiffcrop-R90-rgb-3c-8b.sh.log: tiffcrop-R90-rgb-3c-8b.sh --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tiff2bw-palette-1c-8b.sh.log: tiff2bw-palette-1c-8b.sh + @p='tiff2bw-palette-1c-8b.sh'; \ + b='tiff2bw-palette-1c-8b.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +tiff2bw-quad-lzw-compat.sh.log: tiff2bw-quad-lzw-compat.sh + @p='tiff2bw-quad-lzw-compat.sh'; \ + b='tiff2bw-quad-lzw-compat.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +tiff2bw-rgb-3c-8b.sh.log: tiff2bw-rgb-3c-8b.sh + @p='tiff2bw-rgb-3c-8b.sh'; \ + b='tiff2bw-rgb-3c-8b.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tiff2rgba-logluv-3c-16b.sh.log: tiff2rgba-logluv-3c-16b.sh @p='tiff2rgba-logluv-3c-16b.sh'; \ b='tiff2rgba-logluv-3c-16b.sh'; \ @@ -1826,6 +1862,26 @@ memcheck: ptrcheck: $(MAKE) MEMCHECK='valgrind --tool=exp-ptrcheck --quiet $(VALGRIND_EXTRA_OPTS)' check +# tiff2bw is pretty lame so currently only the generated scripts +# tiff2bw-palette-1c-8b.sh, tiff2bw-quad-lzw-compat.sh, and +# tiff2bw-rgb-3c-8b.sh pass tests. +generate-tiff2bw-tests: + for file in $(TIFFIMAGES) ; \ + do \ + base=`basename $$file .tiff` ; \ + testscript=$(srcdir)/tiff2bw-$$base.sh ; \ + ( \ + echo "#!/bin/sh" ; \ + echo "# Generated file, master is Makefile.am" ; \ + echo ". \$${srcdir:-.}/common.sh" ; \ + echo "infile=\"\$$srcdir/$$file\"" ; \ + echo "outfile=\"o-tiff2bw-$$base.tiff\"" ; \ + echo "f_test_convert \"\$$TIFF2BW\" \$$infile \$$outfile" ; \ + echo "f_tiffinfo_validate \$$outfile" ; \ + ) > $$testscript ; \ + chmod +x $$testscript ; \ + done + generate-tiff2rgba-tests: for file in $(TIFFIMAGES) ; \ do \ @@ -1922,6 +1978,7 @@ generate-tiffcrop-tests: \ generate-tiffcrop-extractz14-tests generate-tests: \ + generate-tiff2bw-tests \ generate-tiff2rgba-tests \ generate-tiffcrop-tests diff --git a/tiff/test/TiffTestCommon.cmake b/tiff/test/TiffTestCommon.cmake index 50a4c34a4..a0db67820 100644 --- a/tiff/test/TiffTestCommon.cmake +++ b/tiff/test/TiffTestCommon.cmake @@ -101,3 +101,8 @@ if(WIN32) file(TO_NATIVE_PATH "${LIBTIFF_DIR}" LIBTIFF_DIR) set(ENV{PATH} "${LIBTIFF_DIR};$ENV{PATH}") endif() +if(CYGWIN) + get_filename_component(LIBTIFF_DIR "${LIBTIFF}" DIRECTORY) + file(TO_NATIVE_PATH "${LIBTIFF_DIR}" LIBTIFF_DIR) + set(ENV{PATH} "${LIBTIFF_DIR}:$ENV{PATH}") +endif() diff --git a/tiff/test/common.sh b/tiff/test/common.sh index 6f9b28202..6b1380dd2 100644 --- a/tiff/test/common.sh +++ b/tiff/test/common.sh @@ -40,6 +40,7 @@ IMG_PALETTE_1C_8B=${IMAGES}/palette-1c-8b.tiff IMG_RGB_3C_16B=${IMAGES}/rgb-3c-16b.tiff IMG_RGB_3C_8B=${IMAGES}/rgb-3c-8b.tiff IMG_MINISBLACK_2C_8B_ALPHA=${IMAGES}/minisblack-2c-8b-alpha.tiff +IMG_QUAD_LZW_COMPAT=${IMAGES}/quad-lzw-compat.tiff IMG_MINISWHITE_1C_1B_PBM=${IMAGES}/miniswhite-1c-1b.pbm IMG_MINISBLACK_1C_8B_PGM=${IMAGES}/minisblack-1c-8b.pgm diff --git a/tiff/test/images/quad-lzw-compat.tiff b/tiff/test/images/quad-lzw-compat.tiff new file mode 100644 index 000000000..ec614bf6f Binary files /dev/null and b/tiff/test/images/quad-lzw-compat.tiff differ diff --git a/tiff/test/tiff2bw-palette-1c-8b.sh b/tiff/test/tiff2bw-palette-1c-8b.sh new file mode 100755 index 000000000..45fe63bdf --- /dev/null +++ b/tiff/test/tiff2bw-palette-1c-8b.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Generated file, master is Makefile.am +. ${srcdir:-.}/common.sh +infile="$srcdir/images/palette-1c-8b.tiff" +outfile="o-tiff2bw-palette-1c-8b.tiff" +f_test_convert "$TIFF2BW" $infile $outfile +f_tiffinfo_validate $outfile diff --git a/tiff/test/tiff2bw-quad-lzw-compat.sh b/tiff/test/tiff2bw-quad-lzw-compat.sh new file mode 100755 index 000000000..bf5d5c944 --- /dev/null +++ b/tiff/test/tiff2bw-quad-lzw-compat.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Generated file, master is Makefile.am +. ${srcdir:-.}/common.sh +infile="$srcdir/images/quad-lzw-compat.tiff" +outfile="o-tiff2bw-quad-lzw-compat.tiff" +f_test_convert "$TIFF2BW" $infile $outfile +f_tiffinfo_validate $outfile diff --git a/tiff/test/tiff2bw-rgb-3c-8b.sh b/tiff/test/tiff2bw-rgb-3c-8b.sh new file mode 100755 index 000000000..8379f5a79 --- /dev/null +++ b/tiff/test/tiff2bw-rgb-3c-8b.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Generated file, master is Makefile.am +. ${srcdir:-.}/common.sh +infile="$srcdir/images/rgb-3c-8b.tiff" +outfile="o-tiff2bw-rgb-3c-8b.tiff" +f_test_convert "$TIFF2BW" $infile $outfile +f_tiffinfo_validate $outfile diff --git a/tiff/test/tiffcp-lzw-compat.sh b/tiff/test/tiffcp-lzw-compat.sh new file mode 100755 index 000000000..bfc8d841e --- /dev/null +++ b/tiff/test/tiffcp-lzw-compat.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# +# Basic sanity check for tiffcp with LZW Old-LZW decompression +# +. ${srcdir:-.}/common.sh +f_test_convert "${TIFFCP} -c none" "${IMG_QUAD_LZW_COMPAT}" "o-tiffcp-lzw-compat.tiff" \ No newline at end of file -- cgit v1.2.1