Commit 59e728bc authored by thomie's avatar thomie Committed by Ben Gamari

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
parent f78b477b
# See Note [Spaces in TEST_HC].
echo
echo 'Possible fix: put quotes around $(TEST_HC) in your Makefile.'
......@@ -1380,8 +1380,10 @@ distclean : clean
# Not sure why this is being cleaned here.
$(call removeTrees,includes/dist-derivedconstants)
# Finally, clean the inplace tree.
$(call removeTrees,inplace)
# Also clean Windows-only inplace directories.
# Don't delete 'inplace' itself, it contains source files.
$(call removeTrees,inplace/mingw)
$(call removeTrees,inplace/perl)
maintainer-clean : distclean
$(call removeFiles,configure mk/config.h.in)
......
# See Note [Spaces in TEST_HC].
echo
echo 'Possible fix: put quotes around $(TEST_HC) in your Makefile.'
bin
\ No newline at end of file
......@@ -27,6 +27,9 @@ INPLACE_PERL = $(INPLACE)/perl
#
################################################################################
# See Note [Spaces in TEST_HC].
# Directory contains multiple spaces, to test that multiple spaces aren't
# getting collapsed into a single space.
BIN_DIST_INST_SUBDIR = "install dir"
BIN_DIST_INST_DIR = bindisttest/$(BIN_DIST_INST_SUBDIR)
......
......@@ -57,6 +57,8 @@ tmp.d
*bindisttest_install___dir_bin_ghc.exe.mk
mk/ghcconfig*_bin_ghc*.mk
mk/ghcconfig*_bin_ghc*.exe.mk
mk/ghcconfig*_test___spaces_ghc*.mk
mk/ghcconfig*_test___spaces_ghc*.exe.mk
*.imports
# -----------------------------------------------------------------------------
......
......@@ -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
......
......@@ -240,9 +240,9 @@ ghcpkg02:
rm -rf $(PACKAGE_CONF_ghcpkg02)
$(GHC_PKG_ghcpkg02) init $(PACKAGE_CONF_ghcpkg02)
set -e; \
for i in `$(GHC_PKG) list --global --simple-output -v0`; do \
for i in `'$(GHC_PKG)' list --global --simple-output -v0`; do \
echo Updating $$i; \
$(GHC_PKG) describe --global $$i | $(GHC_PKG_ghcpkg02) update --global --force -; \
'$(GHC_PKG)' describe --global $$i | $(GHC_PKG_ghcpkg02) update --global --force -; \
done
PKGCONF07=local07.package.conf
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment