diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-05-23 15:37:13 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-05-23 15:37:13 +0100 |
commit | f40bf230953d754577437143a919012d160f91c8 (patch) | |
tree | d1d69f965664f34ea6e475486dbe5c38a3ec36ec | |
parent | 0c70ed844e4cc8698f49b6650648963a9a08b9d9 (diff) |
Factor out actually invoking make n times
-rwxr-xr-x | tt.hs | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -84,6 +84,18 @@ usage = usageInfo header optionDefinitions header = "Usage: tt [-v] [-V] [-d DIALECTS] [-r[N]] [tests...]" {- Building and execution of a `make check-twisted` invocation -} +invokeMake :: [String] -> IO () +invokeMake args = do + (_, _, _, h) <- createProcess $ proc "make" args + exitCode <- waitForProcess h + case exitCode of + ExitSuccess -> return () + ExitFailure _ -> exitWith exitCode + +rep :: Repetitions -> IO () -> IO () +rep Forever = forever +rep (Times n) = replicateM_ n + runTests :: FilePath -> String -> Bool -> [String] -> [Flag] -> Repetitions -> IO () runTests testDir testVar inTree tests flags reps = do @@ -98,16 +110,7 @@ runTests testDir testVar inTree tests flags reps = do ] args = [ "check-twisted", "-s", "-C", testDir ] ++ t ++ flags - let run = do - (_, _, _, h) <- createProcess $ proc "make" args - exitCode <- waitForProcess h - case exitCode of - ExitSuccess -> return () - ExitFailure _ -> exitWith exitCode - - case reps of - Forever -> forever run - Times n -> replicateM_ n run + rep reps $ invokeMake args unprefix :: FilePath -> String -> String unprefix testDir = fromMaybe <*> stripPrefix testDir |