summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-12-09 15:32:58 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-12-17 07:24:40 -0500
commit6ea4eb4babf090e447277a3e4b0dea31d79e9acf (patch)
tree06d4a2e8e137ae55bca7f86c8c01ca22eb628f36
parent7cef0b7d707c0b242ee788919f76a73d1a3d2c96 (diff)
downloadhaskell-6ea4eb4babf090e447277a3e4b0dea31d79e9acf.tar.gz
testsuite: Make ghc_built_by_llvm check more precise
Previously it would hackily look at the flavour name to determine whether LLVM was used to build stage2 ghc. However, this didn't work at all with Hadrian and would miss cases like ARM where we use the LLVM backend by default. See #16087 for the motivation for why ghc_built_by_llvm is needed at all. This should catch one of the ARMv7 failures described in #17555.
-rw-r--r--hadrian/src/Settings/Builders/RunTest.hs4
-rw-r--r--testsuite/config/ghc10
-rw-r--r--testsuite/mk/test.mk8
3 files changed, 11 insertions, 11 deletions
diff --git a/hadrian/src/Settings/Builders/RunTest.hs b/hadrian/src/Settings/Builders/RunTest.hs
index a26092ef49..d3ce1c6fb8 100644
--- a/hadrian/src/Settings/Builders/RunTest.hs
+++ b/hadrian/src/Settings/Builders/RunTest.hs
@@ -93,9 +93,6 @@ runTestBuilderArgs = builder RunTest ? do
let timeoutProg = root -/- timeoutPath
statsFilesDir <- expr haddockStatsFilesDir
- -- See #16087
- let ghcBuiltByLlvm = False -- TODO: Implement this check
-
let asBool :: String -> Bool -> String
asBool s b = s ++ show b
@@ -128,7 +125,6 @@ runTestBuilderArgs = builder RunTest ? do
, arg "-e", arg $ "config.ghc_dynamic_by_default=" ++ show hasDynamicByDefault
, arg "-e", arg $ "config.ghc_dynamic=" ++ show hasDynamic
- , arg "-e", arg $ "config.ghc_built_by_llvm=" ++ show ghcBuiltByLlvm
, arg "-e", arg $ "config.top=" ++ show (top -/- "testsuite")
, arg "-e", arg $ "config.wordsize=" ++ show wordsize
diff --git a/testsuite/config/ghc b/testsuite/config/ghc
index 5e644d5477..884cb1e953 100644
--- a/testsuite/config/ghc
+++ b/testsuite/config/ghc
@@ -179,6 +179,15 @@ def get_compiler_info():
config.have_ncg = compilerInfoDict.get("Have native code generator", "NO") == "YES"
+ # Whether GHC itself was built using the LLVM backend. We need to know this
+ # since some tests in ext-interp fail when stage2 ghc is built using
+ # LLVM. See #16087.
+ #
+ # The condition here is a bit approximate: we assume that if stage2 doesn't
+ # have the NCG and isn't unregisterised then it must be using the LLVM
+ # backend by default.
+ config.ghc_built_by_llvm = not config.have_ncg and not config.unregisterised
+
config.have_RTS_linker = compilerInfoDict.get("target has RTS linker", "NO") == "YES"
# external interpreter needs RTS linker support
# If the field is not present (GHC 8.0 and earlier), assume we don't
@@ -220,6 +229,7 @@ def get_compiler_info():
config.ghc_plugin_way = "normal"
# Note [Replacing backward slashes in config.libdir]
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# We *do* need to replace backslashes in config.libdir, for the following
# reason:
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk
index be6b741751..6e6def19ab 100644
--- a/testsuite/mk/test.mk
+++ b/testsuite/mk/test.mk
@@ -178,6 +178,7 @@ else
RUNTEST_OPTS += -e ghc_with_smp=False
endif
+# Does the LLVM backend work?
ifeq "$(LLC)" ""
RUNTEST_OPTS += -e ghc_with_llvm=False
else ifeq "$(TargetARCH_CPP)" "powerpc"
@@ -244,13 +245,6 @@ else
RUNTEST_OPTS += -e config.local=True
endif
-# Some tests in ext-interp fail when ghc-stage2 is built using LLVM. See #16087
-ifeq "$(findstring llvm,$(BUILD_FLAVOUR))" ""
-RUNTEST_OPTS += -e config.ghc_built_by_llvm=False
-else
-RUNTEST_OPTS += -e config.ghc_built_by_llvm=True
-endif
-
RUNTEST_OPTS += \
--rootdir=. \
--config-file=$(CONFIG) \