summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-10-19 16:02:36 +0100
committerRalf Habacker <ralf.habacker@freenet.de>2015-10-29 05:50:27 +0100
commit24342d5912b828607b1b6efd628b81fb7420f6b8 (patch)
treeee126a49cdf58a80dc6f31371a30678e0c3f6e2e
parent24b6eecc66bd1551e42b20f7b7b8d38b7e12dc32 (diff)
downloaddbus-24342d5912b828607b1b6efd628b81fb7420f6b8.tar.gz
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. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92538 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
-rwxr-xr-xtest/glib-tap-test.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/glib-tap-test.sh b/test/glib-tap-test.sh
index fcb73383..5e5e6e5f 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