summaryrefslogtreecommitdiff
path: root/debian/patch-test-suite.sh
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2013-09-20 17:09:30 +0200
committerAxel Beckert <abe@deuxchevaux.org>2013-09-20 17:09:30 +0200
commitba5c7320d4876deb14dba60584fcdf5d5774e13b (patch)
tree2a49b40c2fb5d888ce8fbcbb8c7dbd13365c593f /debian/patch-test-suite.sh
parent539dc4138822a180c83702f7ba0d23cb37205290 (diff)
downloadzsh-ba5c7320d4876deb14dba60584fcdf5d5774e13b.tar.gz
zsh-ba5c7320d4876deb14dba60584fcdf5d5774e13b.zip
Add conditional patch to prevent FTBFS on Hurd in case of wrong test assumptions
debian/rules now calls debian/patch-test-suite.sh with some parameters to modify or unmodify Test/C02cond.ztst in a way that either the character device for testing zsh's -c either exists or the test for -c is disabled at all. There are three ways in which debian/patch-test-suite.sh can patch Test/C02cond.ztst: * Not at all if /dev/tty exists and is a character device. * Replace all occurrences of /dev/tty with another tty in case /dev/tty does not exist, but others do. * Disable the test for zsh's -c completely if no tty at all is available as to be tested character device.
Diffstat (limited to 'debian/patch-test-suite.sh')
-rwxr-xr-xdebian/patch-test-suite.sh48
1 files changed, 48 insertions, 0 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