summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-05-11 10:31:19 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2021-05-14 08:04:31 +0100
commit7249e211773cfa2aeb2fd9d8a287d92fc9a8d85d (patch)
treee3d7130a2a046388ebee46c0d838ce7306d4c5d4
parentb12b5a8ddf34484dd9bdff859f6dfe7392e632e2 (diff)
downloadhaskell-wip/hadrian-check-ppr.tar.gz
hadrian: Build check-ppr and check-exact using normal hadrian rules when in-treewip/hadrian-check-ppr
Fixes #19606 #19607
-rw-r--r--hadrian/src/Packages.hs2
-rw-r--r--hadrian/src/Rules/Test.hs44
-rw-r--r--hadrian/src/Settings/Default.hs2
3 files changed, 23 insertions, 25 deletions
diff --git a/hadrian/src/Packages.hs b/hadrian/src/Packages.hs
index b107a6e512..c56feae796 100644
--- a/hadrian/src/Packages.hs
+++ b/hadrian/src/Packages.hs
@@ -32,7 +32,7 @@ import Oracles.Setting
-- packages and modify build default build conditions in "UserSettings".
ghcPackages :: [Package]
ghcPackages =
- [ array, base, binary, bytestring, cabal, checkPpr
+ [ array, base, binary, bytestring, cabal, checkPpr, checkExact
, compareSizes, compiler, containers, deepseq, deriveConstants, directory
, exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh
, ghcCompact, ghcHeap, ghci, ghciWrapper, ghcPkg, ghcPrim, haddock, haskeline, hsc2hs
diff --git a/hadrian/src/Rules/Test.hs b/hadrian/src/Rules/Test.hs
index 0a120d1e12..495ec3b7cb 100644
--- a/hadrian/src/Rules/Test.hs
+++ b/hadrian/src/Rules/Test.hs
@@ -69,30 +69,28 @@ 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 ++
- ["-Wall", "-Werror", "-o", top -/- path, top -/- sourcePath] ++
- (maybe [] (\e -> [e]) mextra) ++
- -- 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] ++
+ (maybe [] (\e -> [e]) mextra) ++
+ -- 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.