[Git][ghc/ghc][master] Hadrian: override $(ghc-config-mk), to prevent redundant config generation

Marge Bot gitlab at gitlab.haskell.org
Tue May 7 10:35:54 UTC 2019



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
ba0aed2e by Alp Mestanogullari at 2019-05-06T21:32:56Z
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.

- - - - -


2 changed files:

- hadrian/src/Rules/Test.hs
- testsuite/mk/boilerplate.mk


Changes:

=====================================
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.


=====================================
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))" ""



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/ba0aed2e783435c9175761fc2b20b9302f368a98

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/ba0aed2e783435c9175761fc2b20b9302f368a98
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190507/2b1c6bba/attachment-0001.html>


More information about the ghc-commits mailing list