summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-04-01 11:28:04 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-07 12:38:22 -0400
commit546f8b1478e43f18b25236a20c6c30fa986a046a (patch)
tree49469925beb2c48c849e1bac9d4f47ec5d01b869
parentb06e457dbda93955522e298c698b3ccce9431720 (diff)
downloadhaskell-546f8b1478e43f18b25236a20c6c30fa986a046a.tar.gz
hadrian: Don't try to build iserv-prof if we don't have profiled libraries
Workaround for #19624
-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