diff options
-rwxr-xr-x | debian/patch-test-suite.sh | 48 | ||||
-rw-r--r-- | debian/patches/disable-tests-which-need-dev-tty.patch | 29 | ||||
-rwxr-xr-x | debian/rules | 13 |
3 files changed, 88 insertions, 2 deletions
diff --git a/debian/patch-test-suite.sh b/debian/patch-test-suite.sh new file mode 100755 index 000000000..9e46ae4d2 --- /dev/null +++ b/debian/patch-test-suite.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +set -e + +TEST=Test/C02cond.ztst + +if [ "$1" = "--reverse" ]; then + TTY="$2" + + # Unpatch + if [ "$TTY" = "/dev/tty" ]; then + exit 0; + elif [ -n "$TTY" ]; then + echo "Replacing $TTY with /dev/tty in $TEST" + sed -e "s:$TTY:/dev/tty:" -i $TEST || true + else + echo "Patch back in that check that needs /dev/tty. (Failures are ok.)" + patch -R -f --no-backup-if-mismatch -F0 -r- -s -p1 < debian/patches/disable-tests-which-need-dev-tty.patch || true + fi +else + TTY="$1" + + if [ "$TTY" = "/dev/tty" ]; then + # Sanity check + if [ -c /dev/tty ]; then + echo "/dev/tty exists and is a character device, hence no patching needed." + exit 0; + else + + echo "$MAKE's -c test in debian/rules said /dev/tty is" + echo "a character device, but $0's checks says it's not:" + ls -l /dev/tty + exit 1 + fi + elif [ -n "$TTY" ]; then + echo "Replacing /dev/tty with $TTY in $TEST" + sed -e "s:/dev/tty:$TTY:" -i $TEST + else + echo "Huh? No character device named tty* found at all in /dev/" + # Reality check + find /dev/ -name 'tty*' -type c || true + + echo "Well, then let's patch out that check that needs" + echo "/dev/tty to be a character device." + + patch -f --no-backup-if-mismatch -F0 -r- -s -p1 < debian/patches/disable-tests-which-need-dev-tty.patch + fi +fi diff --git a/debian/patches/disable-tests-which-need-dev-tty.patch b/debian/patches/disable-tests-which-need-dev-tty.patch new file mode 100644 index 000000000..6c2233f3e --- /dev/null +++ b/debian/patches/disable-tests-which-need-dev-tty.patch @@ -0,0 +1,29 @@ +Description: Disable /dev/tty needing test in test-suite + One test in C02cond.ztst of the upstream test-suite always fails if + /dev/tty does not exist or is no character device.. + . + This may be the case on the GNU/Hurd buildds. + . + This patch removes that test. As this is not always wanted, this test + should never be listed in debian/patches/series, but will be applied + when necessary by debian/patch-test-suite.sh. + . + Again: DO NOT LIST THIS PATCH IN THE series FILE. +Author: Axel Beckert <abe@debian.org> + +Index: zsh/Test/C02cond.ztst +=================================================================== +--- zsh.orig/Test/C02cond.ztst 2013-09-14 02:42:12.000000000 +0200 ++++ zsh/Test/C02cond.ztst 2013-09-20 16:04:20.000000000 +0200 +@@ -41,11 +41,6 @@ + fi + 0D:-b cond + +- # Use hardcoded /dev/tty because globbing inside /dev fails on Cygwin +- char=/dev/tty +- [[ -c $char && ! -c $zerolength ]] +-0:-c cond +- + [[ -d . && ! -d zerolength ]] + 0:-d cond + diff --git a/debian/rules b/debian/rules index 042cf8f40..89091281d 100755 --- a/debian/rules +++ b/debian/rules @@ -42,9 +42,13 @@ endif BUILT_USING=$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W libcap-dev libncursesw5-dev libpcre3-dev eglibc) +# Check for /dev/tty and find potential alternatives to avoid test +# suite failures on hurd +TESTTTY=$(shell if [ -c /dev/tty ]; then echo /dev/tty; else find /dev -name 'tty*' -type c | head -1; fi) + build: build-arch build-indep -build-arch: configure-stamp +build-arch: configure-stamp prepare-tests-stamp dh_auto_build -B obj --parallel HOME="$(CURDIR)/obj/testhome" dh_auto_test -B obj --parallel touch $@ @@ -53,7 +57,7 @@ build-indep: configure-stamp dh_auto_build -B obj --parallel -- pdf touch $@ -build-static: configure-static-stamp +build-static: configure-static-stamp prepare-tests-stamp dh_testdir dh_auto_build -B obj-static --parallel HOME="$(CURDIR)/obj-static/testhome" dh_auto_test -B obj-static --parallel || true @@ -62,6 +66,10 @@ build-static: configure-static-stamp build-debug: DEB_BUILD_OPTIONS+=debug build-debug: build +prepare-tests-stamp: + debian/patch-test-suite.sh "$(TESTTTY)" + touch $@ + configure: touch stamp-h.in dh_autoreconf @@ -89,6 +97,7 @@ clean: dh_auto_clean -B obj --parallel dh_auto_clean -B obj-static --parallel dh_auto_clean --parallel + debian/patch-test-suite.sh --reverse $(TESTTTY) dh_clean rm -rf config.cache obj obj-static autom4te.cache |