From fa5ba2e0263969a27144ff1e5a083c7f7e54f698 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Fri, 25 Sep 2015 12:21:10 -0700 Subject: [PATCH] New test PNG files incorporated into make check tests/pngstest-* are changed so that the new test files are divided into 8 groups by gamma and alpha channel. This makes each test take just under 5 seconds on a moderately up-to-date x86_64 system using libpng16 (test times are somewhat variable under libpng17 at present because of the lack of optimization in some gamma processing paths.) These tests have considerably better code and pixel-value coverage than contrib/pngsuite however coverage is still incomplete. Signed-off-by: John Bowler --- Makefile.am | 12 +++------ tests/pngstest | 51 ++++++++++++++++++++++++++++++++----- tests/pngstest-0g01 | 2 -- tests/pngstest-0g02 | 2 -- tests/pngstest-0g04 | 2 -- tests/pngstest-0g08 | 2 -- tests/pngstest-0g16 | 2 -- tests/pngstest-1.8 | 2 ++ tests/pngstest-1.8-alpha | 2 ++ tests/pngstest-2c08 | 2 -- tests/pngstest-2c16 | 2 -- tests/pngstest-3p01 | 2 -- tests/pngstest-3p02 | 2 -- tests/pngstest-3p04 | 2 -- tests/pngstest-3p08 | 2 -- tests/pngstest-4a08 | 2 -- tests/pngstest-4a16 | 2 -- tests/pngstest-6a08 | 2 -- tests/pngstest-6a16 | 2 -- tests/pngstest-error | 14 ---------- tests/pngstest-linear | 2 ++ tests/pngstest-linear-alpha | 2 ++ tests/pngstest-none | 2 ++ tests/pngstest-none-alpha | 2 ++ tests/pngstest-sRGB | 2 ++ tests/pngstest-sRGB-alpha | 2 ++ 26 files changed, 64 insertions(+), 59 deletions(-) delete mode 100755 tests/pngstest-0g01 delete mode 100755 tests/pngstest-0g02 delete mode 100755 tests/pngstest-0g04 delete mode 100755 tests/pngstest-0g08 delete mode 100755 tests/pngstest-0g16 create mode 100755 tests/pngstest-1.8 create mode 100755 tests/pngstest-1.8-alpha delete mode 100755 tests/pngstest-2c08 delete mode 100755 tests/pngstest-2c16 delete mode 100755 tests/pngstest-3p01 delete mode 100755 tests/pngstest-3p02 delete mode 100755 tests/pngstest-3p04 delete mode 100755 tests/pngstest-3p08 delete mode 100755 tests/pngstest-4a08 delete mode 100755 tests/pngstest-4a16 delete mode 100755 tests/pngstest-6a08 delete mode 100755 tests/pngstest-6a16 delete mode 100755 tests/pngstest-error create mode 100755 tests/pngstest-linear create mode 100755 tests/pngstest-linear-alpha create mode 100755 tests/pngstest-none create mode 100755 tests/pngstest-none-alpha create mode 100755 tests/pngstest-sRGB create mode 100755 tests/pngstest-sRGB-alpha diff --git a/Makefile.am b/Makefile.am index ac5f95cf7..5a2498d3e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -55,19 +55,13 @@ TESTS =\ tests/pngvalid-progressive-interlace-standard\ tests/pngvalid-progressive-interlace-transform\ tests/pngvalid-progressive-standard tests/pngvalid-standard\ - tests/pngstest-0g01 tests/pngstest-0g02 tests/pngstest-0g04\ - tests/pngstest-0g08 tests/pngstest-0g16 tests/pngstest-2c08\ - tests/pngstest-2c16 tests/pngstest-3p01 tests/pngstest-3p02\ - tests/pngstest-3p04 tests/pngstest-3p08 tests/pngstest-4a08\ - tests/pngstest-4a16 tests/pngstest-6a08 tests/pngstest-6a16\ - tests/pngstest-error tests/pngunknown-IDAT\ + tests/pngstest-1.8 tests/pngstest-1.8-alpha tests/pngstest-linear\ + tests/pngstest-linear-alpha tests/pngstest-none tests/pngstest-none-alpha\ + tests/pngstest-sRGB tests/pngstest-sRGB-alpha tests/pngunknown-IDAT\ tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\ tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\ tests/pngimage-quick tests/pngimage-full -# These tests are expected, and required, to fail: -XFAIL_TESTS = tests/pngstest-error - # man pages dist_man_MANS= libpng.3 libpngpf.3 png.5 diff --git a/tests/pngstest b/tests/pngstest index f5cbdbcae..30eeead74 100755 --- a/tests/pngstest +++ b/tests/pngstest @@ -2,12 +2,51 @@ # # Usage: # -# tests/pngstest pattern +# tests/pngstest gamma alpha # -# Runs pngstest on all the contrib/pngsuite/[^x]*${pattern}.png files -# NOTE: pattern is used to name the temporary files pngstest generates +# Run ./pngstest on the PNG files in $srcdir/contrib/testpngs which have the +# given gamma and opacity: # -pattern="$1" +# gamma: one of; linear, 1.8, sRGB, none. +# alpha: one of; opaque, tRNS, alpha, none. 'none' is equivalent to !alpha +# +# NOTE: the temporary files pngstest generates have the base name gamma-alpha to +# avoid issues with make -j +# +gamma="$1" shift -exec ./pngstest --strict --tmpfile "${pattern}" --log ${1+"$@"}\ - "${srcdir}/contrib/pngsuite/"[a-wyz]*${pattern}".png" +alpha="$1" +shift +exec ./pngstest --strict --tmpfile "${gamma}-${alpha}-" --log ${1+"$@"} $( + for f in "${srcdir}/contrib/testpngs/"*.png + do + g= + case "$f" in + *-linear[.-]*) + test "$gamma" = "linear" && g="$f";; + + *-sRGB[.-]*) + test "$gamma" = "sRGB" && g="$f";; + + *-1.8[.-]*) + test "$gamma" = "1.8" && g="$f";; + + *) + test "$gamma" = "none" && g="$f";; + esac + + case "$g" in + "") + :;; + + *-alpha[-.]*) + test "$alpha" = "alpha" && echo "$g";; + + *-tRNS[-.]*) + test "$alpha" = "tRNS" -o "$alpha" = "none" && echo "$g";; + + *) + test "$alpha" = "opaque" -o "$alpha" = "none" && echo "$g";; + esac + done +) diff --git a/tests/pngstest-0g01 b/tests/pngstest-0g01 deleted file mode 100755 index 4a495ccb8..000000000 --- a/tests/pngstest-0g01 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 0g01 diff --git a/tests/pngstest-0g02 b/tests/pngstest-0g02 deleted file mode 100755 index 1a607c8e1..000000000 --- a/tests/pngstest-0g02 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 0g02 diff --git a/tests/pngstest-0g04 b/tests/pngstest-0g04 deleted file mode 100755 index 595ba01e3..000000000 --- a/tests/pngstest-0g04 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 0g04 diff --git a/tests/pngstest-0g08 b/tests/pngstest-0g08 deleted file mode 100755 index 21a8b4bb4..000000000 --- a/tests/pngstest-0g08 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 0g08 diff --git a/tests/pngstest-0g16 b/tests/pngstest-0g16 deleted file mode 100755 index 0104c37bd..000000000 --- a/tests/pngstest-0g16 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 0g16 diff --git a/tests/pngstest-1.8 b/tests/pngstest-1.8 new file mode 100755 index 000000000..b2ec21bf6 --- /dev/null +++ b/tests/pngstest-1.8 @@ -0,0 +1,2 @@ +#!/bin/sh +exec "${srcdir}/tests/pngstest" 1.8 none diff --git a/tests/pngstest-1.8-alpha b/tests/pngstest-1.8-alpha new file mode 100755 index 000000000..d00596d55 --- /dev/null +++ b/tests/pngstest-1.8-alpha @@ -0,0 +1,2 @@ +#!/bin/sh +exec "${srcdir}/tests/pngstest" 1.8 alpha diff --git a/tests/pngstest-2c08 b/tests/pngstest-2c08 deleted file mode 100755 index 9e0de6f1e..000000000 --- a/tests/pngstest-2c08 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 2c08 diff --git a/tests/pngstest-2c16 b/tests/pngstest-2c16 deleted file mode 100755 index c1b88b04e..000000000 --- a/tests/pngstest-2c16 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 2c16 diff --git a/tests/pngstest-3p01 b/tests/pngstest-3p01 deleted file mode 100755 index 6aeb8d06c..000000000 --- a/tests/pngstest-3p01 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 3p01 diff --git a/tests/pngstest-3p02 b/tests/pngstest-3p02 deleted file mode 100755 index 770a75c0b..000000000 --- a/tests/pngstest-3p02 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 3p02 diff --git a/tests/pngstest-3p04 b/tests/pngstest-3p04 deleted file mode 100755 index 957d6ae34..000000000 --- a/tests/pngstest-3p04 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 3p04 diff --git a/tests/pngstest-3p08 b/tests/pngstest-3p08 deleted file mode 100755 index d0947afde..000000000 --- a/tests/pngstest-3p08 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 3p08 diff --git a/tests/pngstest-4a08 b/tests/pngstest-4a08 deleted file mode 100755 index 2fab57f01..000000000 --- a/tests/pngstest-4a08 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 4a08 diff --git a/tests/pngstest-4a16 b/tests/pngstest-4a16 deleted file mode 100755 index e4ad5aa9a..000000000 --- a/tests/pngstest-4a16 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 4a16 diff --git a/tests/pngstest-6a08 b/tests/pngstest-6a08 deleted file mode 100755 index aa6c03c3d..000000000 --- a/tests/pngstest-6a08 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 6a08 diff --git a/tests/pngstest-6a16 b/tests/pngstest-6a16 deleted file mode 100755 index 545b1b394..000000000 --- a/tests/pngstest-6a16 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec "${srcdir}/tests/pngstest" 6a16 diff --git a/tests/pngstest-error b/tests/pngstest-error deleted file mode 100755 index ebf3a7b59..000000000 --- a/tests/pngstest-error +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -code=77 # skipped -for t in "${srcdir}/contrib/pngsuite/"x*".png" -do - if test "$t" != "${srcdir}/contrib/pngsuite/x*.png" - then - # not skipped, test it - if ./pngstest --strict --tmpfile "error" --log "$@" "$t" - then - code=0 # oops, success: should not happen! - fi - fi -done -exit $code diff --git a/tests/pngstest-linear b/tests/pngstest-linear new file mode 100755 index 000000000..4a5b3fe8c --- /dev/null +++ b/tests/pngstest-linear @@ -0,0 +1,2 @@ +#!/bin/sh +exec "${srcdir}/tests/pngstest" linear none diff --git a/tests/pngstest-linear-alpha b/tests/pngstest-linear-alpha new file mode 100755 index 000000000..411421036 --- /dev/null +++ b/tests/pngstest-linear-alpha @@ -0,0 +1,2 @@ +#!/bin/sh +exec "${srcdir}/tests/pngstest" linear alpha diff --git a/tests/pngstest-none b/tests/pngstest-none new file mode 100755 index 000000000..09ad740b5 --- /dev/null +++ b/tests/pngstest-none @@ -0,0 +1,2 @@ +#!/bin/sh +exec "${srcdir}/tests/pngstest" none none diff --git a/tests/pngstest-none-alpha b/tests/pngstest-none-alpha new file mode 100755 index 000000000..af6083ff8 --- /dev/null +++ b/tests/pngstest-none-alpha @@ -0,0 +1,2 @@ +#!/bin/sh +exec "${srcdir}/tests/pngstest" none alpha diff --git a/tests/pngstest-sRGB b/tests/pngstest-sRGB new file mode 100755 index 000000000..d8460812c --- /dev/null +++ b/tests/pngstest-sRGB @@ -0,0 +1,2 @@ +#!/bin/sh +exec "${srcdir}/tests/pngstest" sRGB none diff --git a/tests/pngstest-sRGB-alpha b/tests/pngstest-sRGB-alpha new file mode 100755 index 000000000..f1e57d339 --- /dev/null +++ b/tests/pngstest-sRGB-alpha @@ -0,0 +1,2 @@ +#!/bin/sh +exec "${srcdir}/tests/pngstest" sRGB alpha