Add config file and test speed options to testsuite (#624)
[hadrian.git] / src / Settings / Builders / Make.hs
1 module Settings.Builders.Make (makeBuilderArgs, validateBuilderArgs) where
2
3 import GHC
4 import Oracles.Setting
5 import Rules.Gmp
6 import Settings.Builders.Common
7 import CommandLine
8
9 makeBuilderArgs :: Args
10 makeBuilderArgs = do
11 threads <- shakeThreads <$> expr getShakeOptions
12 gmpPath <- expr gmpBuildPath
13 libffiPath <- expr libffiBuildPath
14 let t = show $ max 4 (threads - 2) -- Don't use all Shake's threads
15 mconcat
16 [ builder (Make gmpPath ) ? pure ["MAKEFLAGS=-j" ++ t]
17 , builder (Make libffiPath ) ? pure ["MAKEFLAGS=-j" ++ t, "install"]
18 ]
19
20 validateBuilderArgs :: Args
21 validateBuilderArgs = builder (Make "testsuite/tests") ? do
22 threads <- shakeThreads <$> expr getShakeOptions
23 top <- expr topDirectory
24 compiler <- expr $ fullpath ghc
25 checkPpr <- expr $ fullpath checkPpr
26 checkApiAnnotations <- expr $ fullpath checkApiAnnotations
27 args <- expr $ userSetting defaultTestArgs
28 return [ setTestSpeed $ testSpeed args
29 , "THREADS=" ++ show threads
30 , "TEST_HC=" ++ (top -/- compiler)
31 , "CHECK_PPR=" ++ (top -/- checkPpr)
32 , "CHECK_API_ANNOTATIONS=" ++ (top -/- checkApiAnnotations)
33 ]
34 where
35 fullpath :: Package -> Action FilePath
36 fullpath pkg = programPath =<< programContext Stage1 pkg
37
38 -- | Support for speed of validation
39 setTestSpeed :: TestSpeed -> String
40 setTestSpeed Fast = "fasttest"
41 setTestSpeed Average = "test"
42 setTestSpeed Slow = "slowtest"