summaryrefslogtreecommitdiff
path: root/hadrian/src/Rules/Test.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/src/Rules/Test.hs')
-rw-r--r--hadrian/src/Rules/Test.hs25
1 files changed, 19 insertions, 6 deletions
diff --git a/hadrian/src/Rules/Test.hs b/hadrian/src/Rules/Test.hs
index 43982b9549..ddcb329bd3 100644
--- a/hadrian/src/Rules/Test.hs
+++ b/hadrian/src/Rules/Test.hs
@@ -17,6 +17,7 @@ import Settings.Builders.RunTest
import Settings.Program (programContext)
import Target
import Utilities
+import Context.Type
ghcConfigHsPath :: FilePath
ghcConfigHsPath = "testsuite/mk/ghc-config.hs"
@@ -211,12 +212,24 @@ needIservBins :: Action ()
needIservBins = do
testGhc <- testCompiler <$> userSetting defaultTestArgs
let stg = stageOf testGhc
- rtsways <- interpretInContext (vanillaContext stg ghc) getRtsWays
- need =<< traverse programPath
- [ Context stg iserv w
- | w <- [vanilla, profiling, dynamic]
- , w `elem` rtsways
- ]
+ ws = [vanilla, profiling, dynamic]
+ progs <- catMaybes <$> mapM (canBuild stg) ws
+ need progs
+ where
+ -- Only build iserv binaries if all dependencies are built the right
+ -- way already. In particular this fixes the case of no_profiled_libs
+ -- not working with the testsuite, see #19624
+ canBuild stg w = do
+ contextDeps <- contextDependencies (Context stg iserv w)
+ ws <- forM contextDeps $ \c ->
+ interpretInContext c (getLibraryWays <>
+ if Context.Type.package c == rts
+ then getRtsWays
+ else mempty)
+ if (all (w `elem`) ws)
+ then Just <$> programPath (Context stg iserv w)
+ else return Nothing
+
pkgFile :: Stage -> Package -> Action FilePath
pkgFile stage pkg