summaryrefslogtreecommitdiff
path: root/hadrian/src
diff options
context:
space:
mode:
authorShayne Fletcher <shayne@shaynefletcher.org>2021-06-03 20:34:39 +1000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-06-05 03:47:48 -0400
commit1713cbb038116c2d703238b47f78c4861232db8e (patch)
tree9ef7ba336a7c36defe90ce31c5211666f715b47e /hadrian/src
parent737b0ae194ca33f9bea9a150dada0c933fd75d4d (diff)
downloadhaskell-1713cbb038116c2d703238b47f78c4861232db8e.tar.gz
Make 'count-deps' a ghc/util standalone program
- Move 'count-deps' into 'ghc/utils' so that it can be called standalone. - Move 'testsuite/tests/parser/should_run/' tests 'CountParserDeps' and 'CountAstDeps' to 'testsuite/tests/count-deps' and reimplement in terms of calling the utility - Document how to use 'count-deps' in 'ghc/utils/count-deps/README'
Diffstat (limited to 'hadrian/src')
-rw-r--r--hadrian/src/Packages.hs5
-rw-r--r--hadrian/src/Rules/BinaryDist.hs2
-rw-r--r--hadrian/src/Rules/Test.hs11
-rw-r--r--hadrian/src/Settings/Builders/Make.hs2
-rw-r--r--hadrian/src/Settings/Default.hs2
5 files changed, 17 insertions, 5 deletions
diff --git a/hadrian/src/Packages.hs b/hadrian/src/Packages.hs
index c56feae796..f75236cd9a 100644
--- a/hadrian/src/Packages.hs
+++ b/hadrian/src/Packages.hs
@@ -2,7 +2,7 @@
module Packages (
-- * GHC packages
array, base, binary, bytestring, cabal, checkPpr,
- checkExact,
+ checkExact, countDeps,
compareSizes, compiler, containers, deepseq, deriveConstants, directory,
exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh,
ghcCompact, ghcHeap, ghci, ghciWrapper, ghcPkg, ghcPrim, haddock, haskeline,
@@ -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, checkExact
+ [ array, base, binary, bytestring, cabal, checkPpr, checkExact, countDeps
, compareSizes, compiler, containers, deepseq, deriveConstants, directory
, exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh
, ghcCompact, ghcHeap, ghci, ghciWrapper, ghcPkg, ghcPrim, haddock, haskeline, hsc2hs
@@ -53,6 +53,7 @@ bytestring = lib "bytestring"
cabal = lib "Cabal" `setPath` "libraries/Cabal/Cabal"
checkPpr = util "check-ppr"
checkExact = util "check-exact"
+countDeps = util "count-deps"
compareSizes = util "compareSizes" `setPath` "utils/compare_sizes"
compiler = top "ghc" `setPath` "compiler"
containers = lib "containers" `setPath` "libraries/containers/containers"
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs
index 2c90b3fe5c..75178e2fef 100644
--- a/hadrian/src/Rules/BinaryDist.hs
+++ b/hadrian/src/Rules/BinaryDist.hs
@@ -172,7 +172,7 @@ bindistRules = do
need $ map (bindistFilesDir -/-)
(["configure", "Makefile"] ++ bindistInstallFiles)
need $ map ((bindistFilesDir -/- "wrappers") -/-)
- [ "check-ppr", "check-exact", "ghc", "ghc-iserv", "ghc-pkg"
+ [ "check-ppr", "check-exact", "count-deps", "ghc", "ghc-iserv", "ghc-pkg"
, "ghci-script", "haddock", "hpc", "hp2ps", "hsc2hs"
, "runghc"]
diff --git a/hadrian/src/Rules/Test.hs b/hadrian/src/Rules/Test.hs
index 495ec3b7cb..ff986f879e 100644
--- a/hadrian/src/Rules/Test.hs
+++ b/hadrian/src/Rules/Test.hs
@@ -37,11 +37,17 @@ checkExactSourcePath = "utils/check-exact/Main.hs"
checkExactExtra :: Maybe String
checkExactExtra = Just "-iutils/check-exact"
+countDepsProgPath, countDepsSourcePath :: FilePath
+countDepsProgPath = "test/bin/count-deps" <.> exe
+countDepsSourcePath = "utils/count-deps/Main.hs"
+countDepsExtra :: Maybe String
+countDepsExtra = Just "-iutils/count-deps"
checkPrograms :: [(FilePath, FilePath, Maybe String, Package)]
checkPrograms =
[ (checkPprProgPath, checkPprSourcePath, checkPprExtra, checkPpr)
, (checkExactProgPath, checkExactSourcePath, checkExactExtra, checkExact)
+ , (countDepsProgPath, countDepsSourcePath, countDepsExtra, countDeps)
]
ghcConfigPath :: FilePath
@@ -132,7 +138,9 @@ testRules = do
pythonPath <- builderPath Python
need [ root -/- checkPprProgPath
- , root -/- checkExactProgPath ]
+ , root -/- checkExactProgPath
+ , root -/- countDepsProgPath
+ ]
-- Set environment variables for test's Makefile.
-- TODO: Ideally we would define all those env vars in 'env', so that
@@ -149,6 +157,7 @@ testRules = do
setEnv "TEST_HC_OPTS_INTERACTIVE" ghciFlags
setEnv "CHECK_PPR" (top -/- root -/- checkPprProgPath)
setEnv "CHECK_EXACT" (top -/- root -/- checkExactProgPath)
+ setEnv "COUNT_DEPS" (top -/- root -/- countDepsProgPath)
-- This lets us bypass the need to generate a config
-- through Make, which happens in testsuite/mk/boilerplate.mk
diff --git a/hadrian/src/Settings/Builders/Make.hs b/hadrian/src/Settings/Builders/Make.hs
index 9efea20275..f00aab9776 100644
--- a/hadrian/src/Settings/Builders/Make.hs
+++ b/hadrian/src/Settings/Builders/Make.hs
@@ -26,12 +26,14 @@ validateBuilderArgs = builder (Make "testsuite/tests") ? do
compiler <- expr $ fullpath ghc
checkPpr <- expr $ fullpath checkPpr
checkExact <- expr $ fullpath checkExact
+ countDeps <- expr $ fullpath countDeps
args <- expr $ userSetting defaultTestArgs
return [ setTestSpeed $ testSpeed args
, "THREADS=" ++ show threads
, "TEST_HC=" ++ (top -/- compiler)
, "CHECK_PPR=" ++ (top -/- checkPpr)
, "CHECK_EXACT=" ++ (top -/- checkExact)
+ , "COUNT_DEPS=" ++ (top -/- countDeps)
]
where
fullpath :: Package -> Action FilePath
diff --git a/hadrian/src/Settings/Default.hs b/hadrian/src/Settings/Default.hs
index 1a28e1ca72..2da096efdb 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 ] ++ [ checkPpr, checkExact ])
+testsuitePackages = return ([ timeout | windowsHost ] ++ [ checkPpr, checkExact, countDeps ])
-- | Default build ways for library packages:
-- * We always build 'vanilla' way.