Commit 843790ea authored by Alp Mestanogullari's avatar Alp Mestanogullari Committed by Andrey Mokhov

Fix timeout building rule for Linux (#638)

parent bbdd69bd
......@@ -105,15 +105,18 @@ stage2Packages = return [haddock]
-- | Packages that are built only for the testsuite.
testsuitePackages :: Action [Package]
testsuitePackages = return [ checkApiAnnotations
testsuitePackages = do
win <- windowsHost
return $
[ checkApiAnnotations
, checkPpr
, ghci
, ghcPkg
, hp2ps
, iserv
, parallel
, runGhc
, timeout ]
, runGhc ] ++
[ timeout | win ]
-- | Given a 'Context', compute the name of the program that is built in it
-- assuming that the corresponding package's type is 'Program'. For example, GHC
......
......@@ -29,6 +29,8 @@ testRules = do
cmd [FileStdout $ root -/- ghcConfigPath] (root -/- ghcConfigProgPath)
[ ghcPath ]
root -/- timeoutProgPath ~> timeoutProgBuilder
"validate" ~> do
needTestBuilders
build $ target (vanillaContext Stage2 compiler) (Make "testsuite/tests") [] []
......@@ -38,7 +40,7 @@ testRules = do
-- TODO : Should we remove the previosly generated config file?
-- Prepare Ghc configuration file for input compiler.
need [ root -/- ghcConfigPath ]
need [ root -/- ghcConfigPath, root -/- timeoutProgPath ]
-- TODO This approach doesn't work.
-- Set environment variables for test's Makefile.
......@@ -93,13 +95,12 @@ timeoutProgBuilder = do
copyFile prog (root -/- timeoutProgPath)
else do
python <- builderPath Python
copyFile "testsuite/timeout/timeout.py" (root -/- "test/bin/timeout.py")
copyFile "testsuite/timeout/timeout.py" (root -/- timeoutProgPath <.> "py")
let script = unlines
[ "#!/usr/bin/env sh"
, "exec " ++ python ++ " $0.py \"$@\""
]
liftIO $ do
writeFile (root -/- timeoutProgPath) script
writeFile' (root -/- timeoutProgPath) script
makeExecutable (root -/- timeoutProgPath)
needTestBuilders :: Action ()
......@@ -108,7 +109,6 @@ needTestBuilders = do
needBuilder $ GhcPkg Update Stage1
needBuilder Hpc
needBuilder (Hsc2Hs Stage1)
timeoutProgBuilder
needTestsuitePackages
-- | Extra flags to send to the Haskell compiler to run tests.
......@@ -160,4 +160,3 @@ needfile stage pkg
-- we are going to use, I suppose?
| isLibrary pkg = pkgConfFile (Context stage pkg profilingDynamic)
| otherwise = programPath =<< programContext stage pkg
......@@ -173,4 +173,3 @@ parentPath path = let upPath = init $ splitOn "/" path
-- | TODO: move to hadrian utilities.
fullpath :: Stage -> Package -> Action FilePath
fullpath stage pkg = programPath =<< programContext stage pkg
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment