summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-05-11 10:31:19 +0100
committerZubin <zubin.duggal@gmail.com>2021-10-12 06:43:25 +0000
commit799f1d9cfdc1e90819208ab5fe2da87e2e55c65d (patch)
treeaba112285fe343279cca2eca9ff94f7e8aefa1e6
parent16bfeb8ee2ba8ab6800c423635ba6a65225c07ed (diff)
downloadhaskell-799f1d9cfdc1e90819208ab5fe2da87e2e55c65d.tar.gz
hadrian: Build check-ppr and check-exact using normal hadrian rules when in-tree
Fixes #19606 #19607 (cherry picked from commit 176b1305c92a10ccd0bc37c15e794946c9c1679d)
-rw-r--r--hadrian/src/Rules/Test.hs42
-rw-r--r--hadrian/src/Settings/Default.hs2
2 files changed, 21 insertions, 23 deletions
diff --git a/hadrian/src/Rules/Test.hs b/hadrian/src/Rules/Test.hs
index b1e328368f..d613f38ede 100644
--- a/hadrian/src/Rules/Test.hs
+++ b/hadrian/src/Rules/Test.hs
@@ -62,29 +62,27 @@ testRules = do
top <- topDirectory
depsPkgs <- packageDependencies <$> readPackageData progPkg
- -- when we're about to test an in-tree compiler, we make sure that
- -- we have the corresponding GHC binary available, along with the
- -- necessary libraries to build the check-* programs
- when (testGhc `elem` ["stage1", "stage2", "stage3"]) $ do
+ -- when we're about to test an in-tree compiler, just build the package
+ -- normally, NOT stage3, as there are no rules for stage4 yet
+ if (testGhc `elem` ["stage1", "stage2"])
+ then do
let stg = stageOf testGhc
- ghcPath <- programPath (Context stg ghc vanilla)
- depsLibs <- traverse
- (\p -> pkgRegisteredLibraryFile (vanillaContext stg p))
- depsPkgs
- need (ghcPath : depsLibs)
-
- bindir <- getBinaryDirectory testGhc
- debugged <- ghcDebugged <$> flavour
- dynPrograms <- dynamicGhcPrograms =<< flavour
- cmd [bindir </> "ghc" <.> exe] $
- concatMap (\p -> ["-package", pkgName p]) depsPkgs ++
- ["-o", top -/- path, top -/- sourcePath] ++
- -- If GHC is build with debug options, then build check-ppr
- -- also with debug options. This allows, e.g., to print debug
- -- messages of various RTS subsystems while using check-ppr.
- if debugged then ["-debug"] else [] ++
- -- If GHC is build dynamic, then build check-ppr also dynamic.
- if dynPrograms then ["-dynamic"] else []
+ prog_path <- programPath =<< programContext stg progPkg
+ createFileLink prog_path path
+ -- otherwise, build it by directly invoking ghc
+ else do
+ bindir <- getBinaryDirectory testGhc
+ debugged <- ghcDebugged <$> flavour
+ dynPrograms <- dynamicGhcPrograms =<< flavour
+ cmd [bindir </> "ghc" <.> exe] $
+ concatMap (\p -> ["-package", pkgName p]) depsPkgs ++
+ ["-o", top -/- path, top -/- sourcePath] ++
+ -- If GHC is build with debug options, then build check-ppr
+ -- also with debug options. This allows, e.g., to print debug
+ -- messages of various RTS subsystems while using check-ppr.
+ (if debugged then ["-debug"] else []) ++
+ -- If GHC is build dynamic, then build check-ppr also dynamic.
+ (if dynPrograms then ["-dynamic"] else [])
root -/- ghcConfigPath %> \_ -> do
args <- userSetting defaultTestArgs
diff --git a/hadrian/src/Settings/Default.hs b/hadrian/src/Settings/Default.hs
index deb9bd80b7..b46c8d70ee 100644
--- a/hadrian/src/Settings/Default.hs
+++ b/hadrian/src/Settings/Default.hs
@@ -135,7 +135,7 @@ stage2Packages = stage1Packages
-- | Packages that are built only for the testsuite.
testsuitePackages :: Action [Package]
-testsuitePackages = return [ timeout | windowsHost ]
+testsuitePackages = return ([ timeout | windowsHost ] ++ [ checkPpr, checkExact ])
-- | Default build ways for library packages:
-- * We always build 'vanilla' way.