summaryrefslogtreecommitdiff
path: root/utils/describe-unexpected
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2008-07-03 13:40:03 +0000
committerIan Lynagh <igloo@earth.li>2008-07-03 13:40:03 +0000
commitb2a503ccad3a22c2666262e7451e2ee8b610eda0 (patch)
tree0498c9660727c95b21f0b9d2336a69603a998346 /utils/describe-unexpected
parent79b4f894215ae098c26cfe8fb7bc7f89008e8420 (diff)
downloadhaskell-b2a503ccad3a22c2666262e7451e2ee8b610eda0.tar.gz
Add a program for describing unexpected tests in testlog
This goes through the testlog and spits out any sections that contain "unexpected".
Diffstat (limited to 'utils/describe-unexpected')
-rw-r--r--utils/describe-unexpected/describe-unexpected.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/utils/describe-unexpected/describe-unexpected.hs b/utils/describe-unexpected/describe-unexpected.hs
new file mode 100644
index 0000000000..bf92e9f99b
--- /dev/null
+++ b/utils/describe-unexpected/describe-unexpected.hs
@@ -0,0 +1,25 @@
+
+module Main (main) where
+
+import Data.List
+
+main :: IO ()
+main = do xs <- readFile "testlog"
+ let ls = lines xs
+ tests = breakTests ls
+ unexpectedTests = filter (any ("unexpected" `isInfixOf`)) tests
+ putStr $ unlines $ concat unexpectedTests
+
+breakTests :: [String] -> [[String]]
+breakTests xs = splitStarting ("=====> " `isPrefixOf`)
+ -- Ignore lines telling us that we're running a .T file:
+ $ filter (not . ("====> Running " `isPrefixOf`)) xs
+
+splitStarting :: (a -> Bool) -> [a] -> [[a]]
+splitStarting f xs0 = case break f xs0 of
+ (_, intro : xs) -> ss intro xs
+ _ -> error "No data"
+ where ss intro xs = case break f xs of
+ (this, intro' : rest) ->
+ (intro : this) : ss intro' rest
+ (this, []) -> [intro : this]