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