diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-04-01 11:28:04 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2021-04-01 11:38:28 +0100 |
commit | ae23bcf45c65b2eb73394056ce4d83aac06eaef7 (patch) | |
tree | 3973ec65beae01c4506e1507f4fc7fa534944136 | |
parent | 9c9e40e59214b1e358c85852218f3a67e712a748 (diff) | |
download | haskell-wip/hadrian-no-profiled-libs.tar.gz |
hadrian: Don't try to build iserv-prof if we don't have profiled librarieswip/hadrian-no-profiled-libs
Workaround for #19624
-rw-r--r-- | hadrian/src/Rules/Test.hs | 25 |
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 |