summaryrefslogtreecommitdiff
path: root/testsuite/mk
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-10-28 10:35:08 +0100
committerThomas Miedema <thomasmiedema@gmail.com>2015-12-17 20:25:03 +0100
commit272e1cc811e5d693d8a36e63c90a1ece68a0495a (patch)
treecbb5a4d0df2ec575f6ba142f907186d1cef0dd19 /testsuite/mk
parentc1bd3d444f8c52c688fdbea695ee0ae7f402945d (diff)
downloadhaskell-272e1cc811e5d693d8a36e63c90a1ece68a0495a.tar.gz
Testsuite: allow spaces in TEST_HC passed in by the user
Don't use the GNU make function 'realpath' (reverting e66a81c6), because it doesn't handle spaces in paths. Instead, use 'cygpath' to convert Windows style paths (e.g. C:/foo/) to mingw style paths (e.g. c/foo/), and then call 'which'. Tests: * make TEST_HC=ghc * make TEST_HC=/d/home/thomie/ghc-validate/bindisttest/install\ \ \ dir/bin/ghc * make TEST_HC=D:/home/thomie/ghc-validate/bindisttest/install\ \ \ dir/bin/ghc Reviewed by: Phyx Differential Revision: https://phabricator.haskell.org/D1431
Diffstat (limited to 'testsuite/mk')
-rw-r--r--testsuite/mk/boilerplate.mk30
1 files changed, 13 insertions, 17 deletions
diff --git a/testsuite/mk/boilerplate.mk b/testsuite/mk/boilerplate.mk
index 30398790d0..5f4a3e9c63 100644
--- a/testsuite/mk/boilerplate.mk
+++ b/testsuite/mk/boilerplate.mk
@@ -24,7 +24,9 @@ show:
define canonicalise
# $1 = path variable
-$1_CYGPATH := $$(shell $(SHELL) -c "cygpath -m '$$($1)'" 2> /dev/null)
+# Don't use 'cygpath -m', because it doesn't change drive letters to
+# something 'which' can understand.
+$1_CYGPATH := $$(shell $(SHELL) -c "cygpath '$$($1)'" 2> /dev/null)
ifneq "$$($1_CYGPATH)" ""
# We use 'override' in case we are trying to update a value given on
# the commandline (e.g. TEST_HC)
@@ -121,25 +123,19 @@ else
IMPLICIT_COMPILER = NO
endif
IN_TREE_COMPILER = NO
-# We want to support both "ghc" and "/usr/bin/ghc" as values of TEST_HC
-# passed in by the user, but
-# which ghc == /usr/bin/ghc
-# which /usr/bin/ghc == /usr/bin/ghc
-# so on unix-like platforms we can just always 'which' it.
-# However, on cygwin, we can't just use which:
-# $ which c:/ghc/ghc-7.4.1/bin/ghc.exe
-# which: no ghc.exe in (./c:/ghc/ghc-7.4.1/bin)
-# so we start off by using realpath, and if that succeeds then we use
-# that value. Otherwise we fall back on 'which'.
-#
+
+# As values of TEST_HC passed in by the user, we want to support:
+# * both "ghc" and "/usr/bin/ghc"
+# We use 'which' to convert the former to the latter.
+# * both "C:/path/to/ghc.exe" and "/c/path/to/ghc.exe"
+# We use 'cygpath' to convert the former to the latter, because
+# 'which' can't handle paths starting with a drive letter.
+# * paths that contain spaces
+# So we can't use the GNU make function 'realpath'.
# Note also that we need to use 'override' in order to override a
# value given on the commandline.
-TEST_HC_REALPATH := $(realpath $(TEST_HC))
-ifeq "$(TEST_HC_REALPATH)" ""
+$(eval $(call canonicaliseExecutable,TEST_HC))
override TEST_HC := $(shell which '$(TEST_HC)')
-else
-override TEST_HC := $(TEST_HC_REALPATH)
-endif
endif # "$(TEST_HC)" ""
# We can't use $(dir ...) here as TEST_HC might be in a path