summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-02-24 08:50:10 -0500
committerBen Gamari <ben@smart-cactus.org>2021-02-24 11:15:41 -0500
commit003ea780e93d9885aaf8da7b8df3504d474bef33 (patch)
treea289348a9209249e71f026b7da9a19c8f5ffbfb2 /hadrian
parent7151eaa37b8842f34e75b5e254d8185c3ce73a3d (diff)
downloadhaskell-003ea780e93d9885aaf8da7b8df3504d474bef33.tar.gz
hadrian: Introduce runtest.opts key-value setting
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/doc/user-settings.md3
-rwxr-xr-xhadrian/src/Settings.hs36
2 files changed, 26 insertions, 13 deletions
diff --git a/hadrian/doc/user-settings.md b/hadrian/doc/user-settings.md
index e6146d8ea4..40b55db3a3 100644
--- a/hadrian/doc/user-settings.md
+++ b/hadrian/doc/user-settings.md
@@ -411,6 +411,9 @@ the right names for them:
* `cabal.configure.opts` refers to Cabal configure command line. Note that
package flags can be given by adding `--flags=...` arguments.
+ * `runtest.opts` defines extra arguments passed to `runtest.py` when
+ invoked via the `hadrian test` target.
+
- using a wildcard (`*`) ranges over all possible values for a given "slot";
- `=` entirely overrides the arguments for a given builder in a given context,
with the value specified on the right hand side of `=`, while `+=` merely
diff --git a/hadrian/src/Settings.hs b/hadrian/src/Settings.hs
index 7e712155e2..ab17c5f320 100755
--- a/hadrian/src/Settings.hs
+++ b/hadrian/src/Settings.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE TupleSections #-}
+
module Settings (
getArgs, getLibraryWays, getRtsWays, flavour, knownPackages,
findPackageByName, unsafeFindPackageByName, unsafeFindPackageByPath,
@@ -229,10 +231,12 @@ builderPredicate :: SettingsM Predicate
builderPredicate = builderSetting <&> (\(wstg, wpkg, builderMode) ->
wildcard (pure True) stage wstg <&&>
wildcard (pure True) package wpkg <&&>
- (case builderMode of
- BM_Ghc ghcMode -> wildcard (builder Ghc) (builder . Ghc) ghcMode
- BM_Cc ccMode -> wildcard (builder Cc) (builder . Cc) ccMode
- BM_CabalConfigure -> builder (Cabal Setup) )
+ (case builderMode of
+ BM_Ghc ghcMode -> wildcard (builder Ghc) (builder . Ghc) ghcMode
+ BM_Cc ccMode -> wildcard (builder Cc) (builder . Cc) ccMode
+ BM_CabalConfigure -> builder (Cabal Setup)
+ BM_RunTest -> builder RunTest
+ )
)
where (<&&>) = liftA2 (&&)
@@ -241,6 +245,7 @@ builderPredicate = builderSetting <&> (\(wstg, wpkg, builderMode) ->
data BuilderMode = BM_Ghc (Wildcard GhcMode)
| BM_Cc (Wildcard CcMode)
| BM_CabalConfigure
+ | BM_RunTest
-- | Interpretation-agnostic description of the builder settings
-- supported by Hadrian.
@@ -250,6 +255,7 @@ data BuilderMode = BM_Ghc (Wildcard GhcMode)
-- > (<stage> or *).(<package name> or *).ghc.(<ghc mode> or *).opts
-- > (<stage> or *).(<package name> or *).cc.(<cc mode> or *).opts
-- > (<stage> or *).(<package name> or *).cabal.configure.opts
+-- > runtest.opts
--
-- where:
-- - @<stage>@ is one of @stage0@, @stage1@, @stage2@ or @stage3@;
@@ -269,15 +275,19 @@ data BuilderMode = BM_Ghc (Wildcard GhcMode)
-- appropriate spot.
builderSetting :: Match f
=> f (Wildcard Stage, Wildcard Package, BuilderMode)
-builderSetting = (,,)
- <$> wild stages
- <*> wild pkgs
- <*> matchOneOf
- [ str "ghc" *> fmap BM_Ghc (wild ghcBuilder) <* str "opts"
- , str "cc" *> fmap BM_Cc (wild ccBuilder) <* str "opts"
- , BM_CabalConfigure <$ str "cabal" <* str "configure" <* str "opts"
- ]
-
+builderSetting =
+ matchOneOf
+ [ (,,)
+ <$> wild stages
+ <*> wild pkgs
+ <*> matchOneOf
+ [ str "ghc" *> fmap BM_Ghc (wild ghcBuilder) <* str "opts"
+ , str "cc" *> fmap BM_Cc (wild ccBuilder) <* str "opts"
+ , BM_CabalConfigure <$ str "cabal" <* str "configure" <* str "opts"
+ ]
+ , (Wildcard, Wildcard, BM_RunTest)
+ <$ str "runtest" <* str "opts"
+ ]
where ghcBuilder =
[ ("c", CompileCWithGhc)
, ("cpp", CompileCppWithGhc)