...
 
Commits (3)
......@@ -50,20 +50,20 @@ data Commit = Commit { commitName :: String
}
deriving (Eq, Ord, Show)
commitWorkDir :: Commit -> FilePath
commitWorkDir c = "ghc-" <> sanitize (commitName c)
sanitisedCommitName :: Commit -> String
sanitisedCommitName = map f . commitName
where
sanitize = map f
where
f '/' = '-'
f c = c
f '/' = '-'
f c = c
commitWorkDir :: Commit -> FilePath
commitWorkDir c = "ghc-" <> sanitisedCommitName c
commitResultDir :: Commit -> FilePath
commitResultDir c = "results" </> commitName c
commitResultDir c = "results" </> commitName c -- sanitisedCommitName c
withCommitResultFile :: Commit -> FilePath -> (Handle -> IO a) -> IO a
withCommitResultFile c fname action = do
createDirectoryIfMissing True dir
withFile (dir </> fname) WriteMode action
where
......@@ -143,7 +143,7 @@ build = parallel coresPerBuild $ requires [checkout] $ task "build" run
runInCommitDir commit
$ setStderr (useHandleOpen hdl)
$ setStdout (useHandleOpen hdl)
$ proc ("hadrian" </> "build-cabal") ["-j" <> show coresPerBuild]
$ proc ("hadrian" </> "build.cabal.sh") ["-j" <> show coresPerBuild]
test :: Task
test = parallel coresPerBuild $ requires [build] $ task "test" run
......@@ -153,7 +153,7 @@ test = parallel coresPerBuild $ requires [build] $ task "test" run
runInCommitDir commit
$ setStderr (useHandleOpen hdl)
$ setStdout (useHandleOpen hdl)
$ proc ("hadrian" </> "build-cabal")
$ proc ("hadrian" </> "build.cabal.sh")
$ [ "-j" <> show coresPerBuild
, "--summary-metrics=" <> resultDir </> "test-metrics"
, "test"
......@@ -164,11 +164,12 @@ nofibBoot = parallel 1 $ requires [build] $ task "boot-nofib" run
where
run commit = do
withCommitResultFile commit "build-nofib-deps.log" $ \hdl -> do
cwd <- getCurrentDirectory
runInCommitDir commit
$ setStderr (useHandleOpen hdl)
$ setStdout (useHandleOpen hdl)
$ proc "cabal"
$ ["v1-install", "-w", commitGhcPath commit, "--allow-newer"]
$ ["v1-install", "-w", cwd </> commitGhcPath commit, "--allow-newer"]
++ nofibDeps
nofibRun :: Task
......@@ -176,17 +177,18 @@ nofibRun = requires [nofibBoot] $ task "run-nofib" run
where
run commit = do
withCommitResultFile commit "run-nofib.log" $ \hdl -> do
cwd <- getCurrentDirectory
runProcess_
$ setWorkingDir (commitWorkDir commit </> "nofib")
$ setStderr (useHandleOpen hdl)
$ setStdout (useHandleOpen hdl)
$ proc "cabal"
$ [ "new-run", "nofib-run", "--"
, "--compiler=" <> commitGhcPath commit
, "--compiler-args=-fproc-alignment=64"
, "--compiler=" <> (cwd </> commitGhcPath commit)
, "--compiler-arg=-fproc-alignment=64"
, "--times=" <> show nofibRepeats
, "--perf", "--perf-args", "-e " <> intercalate "," perfEvents
]
, "--output=" <> (cwd </> commitResultDir commit)
] <> concat [ [ "--perf", "--perf-arg=" <> intercalate "," perfEvents] | not (null perfEvents) ]
buildPackage :: String -- ^ package name
-> FilePath -- ^ source directory
......@@ -200,6 +202,7 @@ buildPackage name srcPath ghcPerfArgs hcArgs repeats =
name' = "build-" <> name
run commit = do
withCommitResultFile commit (name'<>".log") $ \hdl -> do
cwd <- getCurrentDirectory
withTempDirectory (commitWorkDir commit) name' $ \tmpDir -> do
runProcess_
$ setWorkingDir (commitWorkDir commit </> srcPath)
......@@ -209,7 +212,7 @@ buildPackage name srcPath ghcPerfArgs hcArgs repeats =
$ [ "-n", name'
, "-o", name'<>".json"
] ++ ghcPerfArgs ++
[ commitGhcPath commit
[ cwd </> commitGhcPath commit
, "-isrc", "-Iinclude", "-fforce-recomp"
, "-odir", tmpDir
, "-hidir", tmpDir
......@@ -219,11 +222,6 @@ runInCommitDir :: Commit -> ProcessConfig stdin stdout stderr -> IO ()
runInCommitDir commit =
runProcess_ . setWorkingDir (commitWorkDir commit)
testNofib :: Task
testNofib = requires [nofibBoot, build] $ task "test-nofib" $ \commit -> do
runInCommitDir commit $ proc "cabal"
[ "v1-install", "-w", commitGhcPath commit, "" ]
readIfExists :: FilePath -> IO (Maybe String)
readIfExists fname = do
exists <- doesFileExist fname
......@@ -299,6 +297,7 @@ main = do
unless exists $ fail "ghc/ should be a GHC checkout"
commits <- readCommits
print commits
let tasks = [checkout,build,test]
--let tasks = [checkout,build,test]
let tasks = [nofibBoot, nofibRun]
runTasks cores commits tasks
cabal-version: >=1.10
name: build-all
version: 0.1.0.0
license: BSD3
license-file: LICENSE
author: Ben Gamari
maintainer: ben@smart-cactus.org
copyright: (c) 2020 Ben Gamari
build-type: Simple
executable build-all
main-is: Run.hs
ghc-options: -threaded
build-depends:
base,
text,
containers,
typed-process,
stm,
async,
directory,
temporary,
filepath
default-language: Haskell2010