From 6a04a34a110aba717135516f0c3331bbd8286a0e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 19 Oct 2015 16:02:36 +0100 Subject: [PATCH 5/6] When running TAP tests, filter out trailing \r from Windows .exe If we're running Windows executables using Wine, then tap-driver.sh won't accept "1..4\r\n" as TAP syntax. --- test/glib-tap-test.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/glib-tap-test.sh b/test/glib-tap-test.sh index fcb7338..5e5e6e5 100755 --- a/test/glib-tap-test.sh +++ b/test/glib-tap-test.sh @@ -10,4 +10,24 @@ set -e t="$1" shift -exec "$t" --tap "$@" + +case "$t" in + (*.exe) + # We're running a Windows executable, possibly on a Unix + # platform. Avoid having invalid TAP syntax like "ok 3\r\n" + # where "ok 3\n" was intended. + echo 1 > "$t".exit-status.tmp + ( + set +e + "$t" --tap "$@" + echo "$?" > "$t".exit-status.tmp + ) | sed -e 's/\r$//' + e="$(cat "$t".exit-status.tmp)" + rm "$t".exit-status.tmp + exit "$e" + ;; + + (*) + exec "$t" --tap "$@" + ;; +esac -- 2.6.1