summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-03-01 11:10:48 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-03 07:37:48 -0500
commitce65d0cceda4a028f30deafa3c39d40a250acc6a (patch)
treee99f990ef63be16371e4e72259836dfa60cc5301
parentc48a7c3a6165d8ffa9ff052db908083817cf6021 (diff)
downloadhaskell-ce65d0cceda4a028f30deafa3c39d40a250acc6a.tar.gz
hadrian: Correctly set whether we have a debug compiler when running tests
For example, running the `slow-validate` flavour would incorrectly run the T16135 test which would fail with an assertion error, despite the fact that is should be skipped when we have a debug compiler.
-rw-r--r--hadrian/src/Flavour/Type.hs2
-rw-r--r--hadrian/src/Settings/Builders/RunTest.hs12
2 files changed, 11 insertions, 3 deletions
diff --git a/hadrian/src/Flavour/Type.hs b/hadrian/src/Flavour/Type.hs
index 9f992fd6f2..b21953e9de 100644
--- a/hadrian/src/Flavour/Type.hs
+++ b/hadrian/src/Flavour/Type.hs
@@ -32,7 +32,7 @@ data Flavour = Flavour {
ghciWithDebugger :: Bool,
-- | Build profiled GHC.
ghcProfiled :: Bool,
- -- | Build GHC with debugging assertions.
+ -- | Build GHC with debug RTS
ghcDebugged :: Bool,
-- | Build the GHC executable against the threaded runtime system.
ghcThreaded :: Bool,
diff --git a/hadrian/src/Settings/Builders/RunTest.hs b/hadrian/src/Settings/Builders/RunTest.hs
index 6a49334a70..51a21183e1 100644
--- a/hadrian/src/Settings/Builders/RunTest.hs
+++ b/hadrian/src/Settings/Builders/RunTest.hs
@@ -2,7 +2,7 @@
module Settings.Builders.RunTest (runTestBuilderArgs, runTestGhcFlags) where
import Hadrian.Utilities
-import System.Environment
+import System.Environment hiding (getArgs)
import CommandLine
import Oracles.TestSettings
@@ -12,6 +12,7 @@ import qualified Data.Set as Set
import Flavour
import qualified Context.Type as C
import System.Directory (findExecutable)
+import Hadrian.Target (target)
getTestSetting :: TestSetting -> Expr String
getTestSetting key = expr $ testSetting key
@@ -95,7 +96,14 @@ inTreeCompilerArgs stg = expr $ do
withInterpreter <- ghcWithInterpreter
unregisterised <- flag GhcUnregisterised
withSMP <- targetSupportsSMP
- debugged <- ghcDebugged <$> flavour
+ -- --info reports "Debug on = YES" if debugIsOn = True which is set by passing -DDEBUG to
+ -- "compiler/GHC/Utils/Constants.hs"
+ debug_args <-
+ interpret (target (Context stg compiler vanilla)
+ (Ghc CompileHs stg)
+ ["compiler" -/- "GHC" -/- "Utils" -/- "Constants.hs"] [""])
+ getArgs
+ let debugged = "-DDEBUG" `elem` debug_args
profiled <- ghcProfiled <$> flavour
os <- setting HostOs