diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2015-10-30 20:22:24 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-10-30 20:22:25 +0100 |
commit | 59e728bc0b47116e3c9a8b21b14dc3198531b9a9 (patch) | |
tree | cbeca1d52f2eb69ba1df117bf3b78844699f7ba2 /testsuite/mk/boilerplate.mk | |
parent | f78b477bd0ba1f85089c515259c9e3145abd1f7b (diff) | |
download | haskell-59e728bc0b47116e3c9a8b21b14dc3198531b9a9.tar.gz |
Testsuite: suggest quoting $(TEST_HC)
Test Plan: it works
Reviewers: bgamari, rwbarton, austin
Reviewed By: austin
Subscribers: rwbarton
Differential Revision: https://phabricator.haskell.org/D1377
Diffstat (limited to 'testsuite/mk/boilerplate.mk')
-rw-r--r-- | testsuite/mk/boilerplate.mk | 61 |
1 files changed, 53 insertions, 8 deletions
diff --git a/testsuite/mk/boilerplate.mk b/testsuite/mk/boilerplate.mk index 8872e52fef..055c85659a 100644 --- a/testsuite/mk/boilerplate.mk +++ b/testsuite/mk/boilerplate.mk @@ -44,15 +44,59 @@ endef ifeq "$(TEST_HC)" "" -STAGE1_GHC := $(abspath $(TOP)/../inplace/bin/ghc-stage1) -STAGE2_GHC := $(abspath $(TOP)/../inplace/bin/ghc-stage2) -STAGE3_GHC := $(abspath $(TOP)/../inplace/bin/ghc-stage3) - -ifneq "$(wildcard $(STAGE1_GHC) $(STAGE1_GHC).exe)" "" - +# Note [Spaces in TEST_HC] +# +# Tests should be able to handle paths with spaces. +# +# One of the things ./validate (without --fast) does is check if binary +# distributions can succesfully be installed and used in paths containing +# spaces. +# +# It does so in the following way: +# * create a binary distribution in 'bindistprep/'. +# * install that binary distribution in 'bindisttest/install dir/' +# * run the testsuite with BINDIST=YES +# +# BINDIST=YES tells the testsuite driver to use +# 'bindisttest/install dir/bin/ghc' instead of 'inplace/bin/ghc-stage2' as +# TEST_HC. +# +# Before, if a GHC developer forgot to quote TEST_HC in their Makefile when +# adding a new test, the test would fail with a puzzling "command not found: +# bindisttest/install" error (but only when validating). +# +# Therefore, we now: +# * make sure 'bindisttest/install' does exist, and show a nice message when +# it is executed. +# * let the default value of TEST_HC also contain spaces +# (i.e. 'inplace/test spaces/ghc-stage2'), such that the test always +# fails, also without BINDIST=YES, and again show a nice message when it +# indeed does so, through 'inplace/test'. + +# The `wildcard` function requires spaces to be escaped. Other gnu make +# functions can't seem to handle spaces at all (e.g. `abspath`). +STAGE1_TEST_SPACES := $(TOP)/../inplace/test\ \ \ spaces/ghc-stage1 +STAGE1_NORMAL := $(TOP)/../inplace/bin/ghc-stage1 + +ifneq "$(wildcard $(STAGE1_TEST_SPACES) $(STAGE1_NORMAL))" "" IMPLICIT_COMPILER = NO IN_TREE_COMPILER = YES + +ifneq "$(wildcard $(STAGE1_TEST_SPACES))" "" +# See Note [Spaces in TEST_HC]. +STAGE1_GHC := $(abspath $(TOP)/../)/inplace/test spaces/ghc-stage1 +STAGE2_GHC := $(abspath $(TOP)/../)/inplace/test spaces/ghc-stage2 +STAGE3_GHC := $(abspath $(TOP)/../)/inplace/test spaces/ghc-stage3 +else +# Maybe we're on Windows (no symlink support), or in a bindist or sdist, which +# don't have the 'test spaces' symlink. +STAGE1_GHC := $(abspath $(TOP)/../)/inplace/bin/ghc-stage1 +STAGE2_GHC := $(abspath $(TOP)/../)/inplace/bin/ghc-stage2 +STAGE3_GHC := $(abspath $(TOP)/../)/inplace/bin/ghc-stage3 +endif + ifeq "$(BINDIST)" "YES" +# See Note [Spaces in TEST_HC]. TEST_HC := $(abspath $(TOP)/../)/bindisttest/install dir/bin/ghc else ifeq "$(stage)" "1" TEST_HC := $(STAGE1_GHC) @@ -69,7 +113,8 @@ IN_TREE_COMPILER = NO TEST_HC := $(shell which ghc) endif -else +else # neq "$(TEST_HC)" "" + ifeq "$(TEST_HC)" "ghc" IMPLICIT_COMPILER = YES else @@ -95,7 +140,7 @@ override TEST_HC := $(shell which '$(TEST_HC)') else override TEST_HC := $(TEST_HC_REALPATH) endif -endif +endif # "$(TEST_HC)" "" # We can't use $(dir ...) here as TEST_HC might be in a path # containing spaces |