[commit: ghc] master: Fix timeout building rule for Linux (#638) (843790e)

git at git.haskell.org git at git.haskell.org
Tue Oct 23 20:18:29 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/843790ea9b3f33494a4dfbfc19efac68b6b3a7ea/ghc

>---------------------------------------------------------------

commit 843790ea9b3f33494a4dfbfc19efac68b6b3a7ea
Author: Alp Mestanogullari <alpmestan at gmail.com>
Date:   Wed Jun 27 17:31:52 2018 +0200

    Fix timeout building rule for Linux (#638)


>---------------------------------------------------------------

843790ea9b3f33494a4dfbfc19efac68b6b3a7ea
 src/GHC.hs                       | 21 ++++++++++++---------
 src/Rules/Test.hs                | 11 +++++------
 src/Settings/Builders/RunTest.hs |  1 -
 3 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/src/GHC.hs b/src/GHC.hs
index 9b453e5..f84d3d6 100644
--- a/src/GHC.hs
+++ b/src/GHC.hs
@@ -105,15 +105,18 @@ stage2Packages = return [haddock]
 
 -- | Packages that are built only for the testsuite.
 testsuitePackages :: Action [Package]
-testsuitePackages = return [ checkApiAnnotations
-                           , checkPpr
-                           , ghci
-                           , ghcPkg
-                           , hp2ps
-                           , iserv
-                           , parallel
-                           , runGhc
-                           , timeout           ]
+testsuitePackages = do
+  win <- windowsHost
+  return $
+    [ checkApiAnnotations
+    , checkPpr
+    , ghci
+    , ghcPkg
+    , hp2ps
+    , iserv
+    , parallel
+    , 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
diff --git a/src/Rules/Test.hs b/src/Rules/Test.hs
index d8d644e..6a04c1e 100644
--- a/src/Rules/Test.hs
+++ b/src/Rules/Test.hs
@@ -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
-
diff --git a/src/Settings/Builders/RunTest.hs b/src/Settings/Builders/RunTest.hs
index 9f30848..6c0c52f 100644
--- a/src/Settings/Builders/RunTest.hs
+++ b/src/Settings/Builders/RunTest.hs
@@ -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
-



More information about the ghc-commits mailing list