summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlp Mestanogullari <alpmestan@gmail.com>2019-04-23 14:46:42 +0200
committerAlp Mestanogullari <alp@well-typed.com>2019-05-06 17:32:56 -0400
commitba0aed2e783435c9175761fc2b20b9302f368a98 (patch)
tree3a3fd1b976c8ec4535b97b15f71b8ddc64415c5d
parente172a6d127a65b945b31306ff7b6c43320debfb4 (diff)
downloadhaskell-ba0aed2e783435c9175761fc2b20b9302f368a98.tar.gz
Hadrian: override $(ghc-config-mk), to prevent redundant config generation
This required making the 'ghc-config-mk' variable overridable in testsuite/mk/boilerplate.mk, and then making use of this in hadrian to point to '<build root>/test/ghcconfig' instead, which is where we always put the test config. Previously, we would build ghc-config and run it against the GHC to be tested, a second time, while we're running the tests, because some include testsuite/mk/boilerplate.mk. This was causing unexpected output failures.
-rw-r--r--hadrian/src/Rules/Test.hs8
-rw-r--r--testsuite/mk/boilerplate.mk2
2 files changed, 10 insertions, 0 deletions
diff --git a/hadrian/src/Rules/Test.hs b/hadrian/src/Rules/Test.hs
index f7e5c45051..6a010df45a 100644
--- a/hadrian/src/Rules/Test.hs
+++ b/hadrian/src/Rules/Test.hs
@@ -107,6 +107,9 @@ testRules = do
-- Shake can keep track of them, but it is not as easy as it seems
-- to get that to work.
liftIO $ do
+ -- Many of those env vars are used by Makefiles in the
+ -- test infrastructure, or from tests or their
+ -- Makefiles.
setEnv "MAKE" makePath
setEnv "PYTHON" pythonPath
setEnv "TEST_HC" ghcPath
@@ -116,6 +119,11 @@ testRules = do
setEnv "CHECK_API_ANNOTATIONS"
(top -/- root -/- checkApiAnnotationsProgPath)
+ -- This lets us bypass the need to generate a config
+ -- through Make, which happens in testsuite/mk/boilerplate.mk
+ -- which is in turn included by all test 'Makefile's.
+ setEnv "ghc-config-mk" (top -/- root -/- ghcConfigPath)
+
-- Execute the test target.
-- We override the verbosity setting to make sure the user can see
-- the test output: https://gitlab.haskell.org/ghc/ghc/issues/15951.
diff --git a/testsuite/mk/boilerplate.mk b/testsuite/mk/boilerplate.mk
index 4c32f30ee2..3dc84f02e0 100644
--- a/testsuite/mk/boilerplate.mk
+++ b/testsuite/mk/boilerplate.mk
@@ -240,11 +240,13 @@ $(TOP)/mk/ghc-config : $(TOP)/mk/ghc-config.hs
empty=
space=$(empty) $(empty)
+ifeq "$(ghc-config-mk)" ""
ghc-config-mk = $(TOP)/mk/ghcconfig$(subst $(space),_,$(subst :,_,$(subst /,_,$(subst \,_,$(TEST_HC))))).mk
$(ghc-config-mk) : $(TOP)/mk/ghc-config
$(TOP)/mk/ghc-config "$(TEST_HC)" >"$@"; if [ $$? != 0 ]; then $(RM) "$@"; exit 1; fi
# If the ghc-config fails, remove $@, and fail
+endif
# Note: $(CLEANING) is not defined in the testsuite.
ifeq "$(findstring clean,$(MAKECMDGOALS))" ""