From 40ba0e169581d2998fa43b3462a397e21bea6cec Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 26 Nov 2016 22:26:00 -0500 Subject: media-libs/netpbm: rework how we skip tests of disabled tools --- media-libs/netpbm/files/netpbm-10.76.00-test.patch | 179 ++++++++++++++++++--- media-libs/netpbm/netpbm-10.76.00.ebuild | 23 --- 2 files changed, 158 insertions(+), 44 deletions(-) (limited to 'media-libs/netpbm') diff --git a/media-libs/netpbm/files/netpbm-10.76.00-test.patch b/media-libs/netpbm/files/netpbm-10.76.00-test.patch index 65f30d57189a..868358cc1a3d 100644 --- a/media-libs/netpbm/files/netpbm-10.76.00-test.patch +++ b/media-libs/netpbm/files/netpbm-10.76.00-test.patch @@ -1,22 +1,159 @@ -https://bugs.gentoo.org/450530 +automatically skip tests of disabled tools -we disable fiascotopnm all the time, so delete the test too - ---- a/test/all-in-place.test -+++ b/test/all-in-place.test -@@ -53,7 +53,6 @@ ordinary_testprogs="\ - ddbugtopbm \ - escp2topbm \ - eyuvtoppm \ -- fiascotopnm \ - fitstopnm \ - fstopgm \ - g3topbm \ ---- a/test/Test-Order -+++ b/test/Test-Order -@@ -153,5 +153,4 @@ - - # Round-trip tests : lossy converters - --fiasco-roundtrip.test - yuv-roundtrip.test +--- GNUmakefile ++++ GNUmakefile +@@ -455,6 +455,17 @@ deb: + .PHONY: check-package + .PHONY: check-install + ++# Variables from the make env we pass down to the test scripts. ++CHECK_VARS = \ ++ BUILDDIR=$(BUILDDIR) \ ++ RGBDEF=$(RGBDEF) \ ++ BUILD_FIASCO=$(BUILD_FIASCO) \ ++ JASPERLIB="$(JASPERLIB)" \ ++ JBIGLIB="$(JBIGLIB)" \ ++ JPEGLIB="$(JPEGLIB)" \ ++ TIFFLIB="$(TIFFLIB)" \ ++ URTLIB="$(URTLIB)" ++ + # Test files in source tree. + + check-tree : BUILDBINDIRS :=./analyzer \ +@@ -525,10 +536,10 @@ resultdir-backup: FORCE + + check-tree: $(TESTRANDOM) resultdir-backup + cd $(RESULTDIR); \ ++ $(CHECK_VARS) \ + CHECK_TYPE=tree \ +- PBM_TEST_PATH=$(PBM_TEST_PATH) BUILDDIR=$(BUILDDIR) \ ++ PBM_TEST_PATH=$(PBM_TEST_PATH) \ + LD_LIBRARY_PATH=$(PBM_LIBRARY_PATH):${LD_LIBRARY_PATH} \ +- RGBDEF=$(RGBDEF) \ + $(SRCDIR)/test/Execute-Tests 2>&1 + + # Execute-Tests needs to know BUILDDIR in order to locate testrandom. +@@ -545,19 +556,18 @@ check: check-package + + check-package: $(TESTRANDOM) resultdir-backup + cd $(RESULTDIR); \ ++ $(CHECK_VARS) \ + CHECK_TYPE=package \ +- PBM_TEST_PATH=$(PBM_TEST_PATH) BUILDDIR=$(BUILDDIR) \ ++ PBM_TEST_PATH=$(PBM_TEST_PATH) \ + LD_LIBRARY_PATH=$(PBM_LIBRARY_PATH):${LD_LIBRARY_PATH} \ +- RGBDEF=$(RGBDEF) \ + $(SRCDIR)/test/Execute-Tests 2>&1 + + + # Check after install + check-install: $(TESTRANDOM) resultdir-backup + cd $(RESULTDIR); \ ++ $(CHECK_VARS) \ + CHECK_TYPE=install \ +- BUILDDIR=$(BUILDDIR) \ +- RGBDEF=$(RGBDEF) \ + $(SRCDIR)/test/Execute-Tests 2>&1 + + +--- test/all-in-place.test ++++ test/all-in-place.test +@@ -367,11 +367,49 @@ ordinary_testprogs="\ + zeisstopnm \ + " + ++enabled_testprog() { ++ case $1 in ++ fiascotopnm|\ ++ pnmtofiasco) ++ [ "${BUILD_FIASCO}" = "N" ] && return 1 ;; ++ ++ jpeg2ktopam|\ ++ pamtojpeg2k) ++ [ "${JASPERLIB}" = "NONE" ] && return 1 ;; ++ ++ jbigtopnm|\ ++ pnmtojbig) ++ [ "${JBIGLIB}" = "NONE" ] && return 1 ;; ++ ++ jpegtopnm|\ ++ pnmtojpeg|\ ++ ppmtojpeg) ++ [ "${JPEGLIB}" = "NONE" ] && return 1 ;; ++ ++ pamtotiff|\ ++ pnmtotiffcmyk|\ ++ tifftopnm) ++ [ "${TIFFLIB}" = "NONE" ] && return 1 ;; ++ ++ pnmtorle|\ ++ rletopnm) ++ [ "${URTLIB}" = "NONE" ] && return 1 ;; ++ esac ++ ++ return 0 ++} ++ + # The string "fiascotopnm" has to be filtered out by egrep for fiascotopnm + # has a slightly different version report format. + + for i in $ordinary_testprogs + do ++ # Stub out programs that aren't built. ++ if ! enabled_testprog "$i"; then ++ echo "$i: ok" ++ continue ++ fi ++ + $i --version 2>&1 | \ + egrep -v -e fiascotopnm -e \ + "(Using libnetpbm|Compiled|(BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" \ +--- test/fiasco-roundtrip.test ++++ test/fiasco-roundtrip.test +@@ -2,6 +2,10 @@ + # This script tests: pnmtofiasco fiascotopnm + # Also requires: pnmpad + ++if [ "${BUILD_FIASCO}" = "N" ]; then ++ exit 80 ++fi ++ + # Should print 215556145 102615 + + pnmpad --black --bottom 1 --left 1 testimg.ppm | \ +--- test/jbig-roundtrip.test ++++ test/jbig-roundtrip.test +@@ -2,6 +2,9 @@ + # This script tests: pnmtojbig jbigtopnm + # Also requires: pamchannel pamtopnm + ++if [ "${JBIGLIB}" = "NONE" ]; then ++ exit 80 ++fi + + # Test 1. Should print 2425386270 41 + pnmtojbig testgrid.pbm | jbigtopnm | cksum +--- test/tiff-roundtrip.test ++++ test/tiff-roundtrip.test +@@ -2,6 +2,9 @@ + # This script tests: pamtotiff tifftopnm + # Also requires: + ++if [ "${TIFFLIB}" = "NONE" ]; then ++ exit 80 ++fi + + # Failure message + ## Second test fails if Netpbm was built without the flate library +--- test/utahrle-roundtrip.test ++++ test/utahrle-roundtrip.test +@@ -2,6 +2,9 @@ + # This script tests: pnmtorle rletopnm + # Also requires: pamchannel pamtopnm + ++if [ "${URTLIB}" = "NONE" ]; then ++ exit 80 ++fi + + #Test 1. Should produce 1571496937 33838, cksum of testimg.red + pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ diff --git a/media-libs/netpbm/netpbm-10.76.00.ebuild b/media-libs/netpbm/netpbm-10.76.00.ebuild index 225eb6368fe6..a63466ff1253 100644 --- a/media-libs/netpbm/netpbm-10.76.00.ebuild +++ b/media-libs/netpbm/netpbm-10.76.00.ebuild @@ -60,29 +60,6 @@ src_prepare() { sed -i '/SUPPORT_SUBDIRS/s:urt::' GNUmakefile || die rm -r urt converter/other/jbig/libjbig converter/other/jpeg2000/libjasper || die - # disable certain tests based on active USE flags - local del=( - $(usex jbig '' 'jbigtopnm pnmtojbig jbig-roundtrip') - $(usex rle '' 'utahrle-roundtrip') - $(usex tiff '' 'tiff-roundtrip') - ) - if [[ ${#del[@]} -gt 0 ]] ; then - sed -i -r $(printf -- ' -e /%s.test/d' "${del[@]}") test/Test-Order || die - fi - del=( - pnmtofiasco fiascotopnm # We always disable fiasco - $(usex jpeg '' 'jpegtopnm pnmtojpeg ppmtojpeg') - $(usex jbig '' 'jbigtopnm pnmtojbig') - $(usex jpeg2k '' 'jpeg2ktopam pamtojpeg2k') - $(usex rle '' 'pnmtorle rletopnm') - $(usex tiff '' 'pamtotiff pnmtotiff pnmtotiffcmyk tifftopnm') - ) - if [[ ${#del[@]} -gt 0 ]] ; then - sed -i -r $(printf -- ' -e s/\<%s\>(:.ok)?//' "${del[@]}") \ - test/{all-in-place,legacy-names}.{ok,test} || die - sed -i '/^$/d' test/{all-in-place,legacy-names}.ok || die - fi - # take care of the importinc stuff ourselves by only doing it once # at the top level and having all subdirs use that one set #149843 sed -i \ -- cgit v1.2.3