buildbot: add NoSlow support
authorbenl@ouroborus.net <unknown>
Wed, 3 Nov 2010 07:12:39 +0000 (07:12 +0000)
committerbenl@ouroborus.net <unknown>
Wed, 3 Nov 2010 07:12:39 +0000 (07:12 +0000)
dph-buildbot/dph-builbot.cabal
dph-buildbot/src/Args.hs
dph-buildbot/src/BuildLibs.hs
dph-buildbot/src/BuildTest.hs
dph-buildbot/src/Config.hs
dph-buildbot/src/Main.hs

index d04e89e..7f13c4b 100644 (file)
@@ -20,7 +20,8 @@ Executable dph-buildbot
         time                >= 1.1    && <= 1.3,
         parseargs           == 0.1.*,
         buildbox            == 1.2.*,
-        mtl                 == 1.1.*
+        mtl                 == 1.1.*,
+        random              == 1.*
 
   Main-is:        Main.hs
   hs-source-dirs: src
index 0680230..4a97d23 100644 (file)
@@ -31,6 +31,7 @@ data BuildArg
        -- Testing DPH and Repa
        | ArgDoTestRepa
        | ArgDoTestDPH
+       | ArgDoTestNoSlow
        | ArgTestIterations
        | ArgMailFrom 
        | ArgMailTo
@@ -140,6 +141,12 @@ buildArgs
                , argData       = Nothing
                , argDesc       = "Run Repa regression tests." }
 
+       , Arg   { argIndex      = ArgDoTestNoSlow
+               , argAbbr       = Nothing
+               , argName       = Just "test-noslow"
+               , argData       = Nothing
+               , argDesc       = "Run NoSlow regression tests." }
+
        , Arg   { argIndex      = ArgTestIterations
                , argAbbr       = Just 'i'
                , argName       = Just "iterations"
index dc00f84..1879d2d 100644 (file)
@@ -103,7 +103,8 @@ libBuild config spec
        Repo dir
         -> do  outLn   $ "  - Building " ++ dir
                inDir dir
-                $ do   pkgConfigure config
+                $ do   -- pkgClean
+                       pkgConfigure config
                        pkgBuild
                        pkgInstall
                        outBlank
@@ -126,13 +127,15 @@ libBuildSub config sub
  = case sub of
        Install pkg
         -> inDir pkg
-        $ do   pkgConfigure config
+        $ do   pkgClean
+               pkgConfigure config
                pkgBuild
                pkgInstall
                
        Build pkg
         -> inDir pkg
-        $ do   pkgConfigure config
+        $ do   pkgClean
+               pkgConfigure config
                pkgBuild
                
 
@@ -146,6 +149,12 @@ pkgConfigure config
                ++ " --with-hc-pkg="   ++ configWithGhcPkg config
 
 
+pkgClean :: Build ()
+pkgClean
+ = do  setupFile       <- findSetupFile
+       ssystem $ "runghc " ++ setupFile ++ " clean"
+
+
 pkgBuild :: Build ()
 pkgBuild
  = do  setupFile       <- findSetupFile
index b513edb..1241678 100644 (file)
@@ -7,6 +7,7 @@ import Benchmarks
 import Config
 import BuildBox
 import Data.Maybe
+import Control.Monad
 
 data BuildResults
        = BuildResults
@@ -64,8 +65,20 @@ buildTest config env
                                (benchmarksRepa config)
             else return []
 
+       -- Run NoSlow benchmarks
+       benchResultsNoSlow
+        <- if (configDoTestNoSlow config)
+            then 
+               inDir (scratchDir ++ "/NoSlow-head") $
+               withTempFile $ \filePath ->
+                do     ssystem  $ "dist/build/noslow/noslow -o " ++ filePath
+                       liftM parseNoSlowLog $ io $ readFile filePath
+               
+            else return []
+       
+
        let benchResults
-               = benchResultsDPH ++ benchResultsRepa   
+               = benchResultsDPH ++ benchResultsRepa ++ benchResultsNoSlow
 
        -- Make the build results.
        let buildResults
@@ -109,3 +122,27 @@ buildTest config env
                        sendMailWithMailer mail defaultMailer                           
                        return ())
                (configMailFromTo config)
+
+
+parseNoSlowLog :: String -> [BenchResult]
+parseNoSlowLog str
+       = map parseNoSlowLine
+       $ tail
+       $ lines str
+
+parseNoSlowLine :: String -> BenchResult
+parseNoSlowLine str
+ = let [name, mean, meanLB, meanUB, _, _, _]
+               = words $ map (\c -> if c == ',' then ' ' else c) str
+       
+   in  BenchResult
+               { benchResultName       = "noslow-" ++ (read name)
+               , benchResultRuns       
+                  =    [ BenchRunResult (read mean   * 1000) Nothing
+                       , BenchRunResult (read meanLB * 1000) Nothing
+                       , BenchRunResult (read meanUB * 1000) Nothing ] }
+       
+       
+       
+       
+       
\ No newline at end of file
index da98187..cebeaca 100644 (file)
@@ -30,18 +30,13 @@ data Config
        , configWithGhcPkg      :: FilePath
 
        -- What libraries we should install into the GHC tree.
-       --   The libraries are installed in the order they appear on the command line.
-       --   syntax of args spec is like:
-       --     package:bmp-1.1.1.1       -- cabal install some package, downloading it off Hackage.
-       --     checkout:libs/QuickCheck  -- cabal configure ; build ; install a package from a local dir.
-       -- 
        --   TODO: If we had a better options parser we wouldn't have to hack everything into the same arg.
-       -- 
        , configLibs            :: Maybe String
 
        -- Test stages
        , configDoTestRepa      :: Bool 
        , configDoTestDPH       :: Bool
+       , configDoTestNoSlow    :: Bool
 
        -- Testing config.
        , configIterations      :: Int
@@ -129,6 +124,7 @@ slurpConfig args
                -- Testing stages
                , configDoTestRepa      = gotArg args ArgDoTestRepa
                , configDoTestDPH       = gotArg args ArgDoTestDPH
+               , configDoTestNoSlow    = gotArg args ArgDoTestNoSlow
 
                -- Testing config.
                , configIterations      = iterations 
index 6f9049b..6047036 100644 (file)
@@ -19,6 +19,7 @@ import Control.Monad
 import Control.Monad.Error.Class
 import System.Console.ParseArgs        hiding (args)
 import System.IO
+import System.Random
 import Data.Maybe
 
 main :: IO ()
@@ -59,12 +60,13 @@ mainWithArgs args
        | (or $ map (gotArg args)
                [ ArgGhcUnpack,  ArgGhcBuild,  ArgGhcUnpackBuild
                , ArgLibs
-               , ArgDoTestRepa, ArgDoTestDPH])
+               , ArgDoTestRepa, ArgDoTestDPH, ArgDoTestNoSlow])
 
        = do    -- Load up cmd line args into our config structure.
-               config  <- slurpConfig args
+               config          <- slurpConfig args
+               uid :: Integer  <- liftM fromIntegral $ getStdRandom (randomR (0 :: Integer, 1000000))
                let buildState
-                       = (buildStateDefault 0 "/tmp")
+                       = (buildStateDefault uid "/tmp")
                        { buildStateLogSystem   = if gotArg args ArgVerbose
                                                        then Just stdout
                                                        else Nothing }
@@ -200,7 +202,7 @@ runTotal config
         $ libsBuild configNew
                                                
        -- Run benchmarks and write results to file, or mail them to the list.
-       when (configDoTestRepa configNew || configDoTestDPH configNew)
+       when (configDoTestRepa configNew || configDoTestDPH configNew || configDoTestNoSlow configNew)
         $ buildTest configNew env