1module Utils where
2
3files :: [FilePath]
4files = map ("test/"++)
5    [ "queens-ghc-6.12.1.eventlog"
6    , "queens-ghc-7.0.2.eventlog"
7    , "mandelbrot-mmc-2011-06-14.eventlog"
8    , "nonmoving-gc.eventlog"
9    , "nonmoving-gc-census.eventlog"
10    , "parallelTest.eventlog"
11    , "pre77stop.eventlog", "782stop.eventlog", "783stop.eventlog"
12    , "sleep.h.eventlog"
13    , "sleep.hC.eventlog"
14    , "sleep.hm.eventlog"
15    , "sleep.hd.eventlog"
16    , "sleep.hy.eventlog"
17    , "stop.hT.eventlog"
18    , "hello-ghc-8.2.2.eventlog", "hello-ghc-8.6.5.eventlog"
19    , "biographical-samples.eventlog"
20    , "time-prof.eventlog"
21    , "trace-binary-event.eventlog"
22    , "unicode.eventlog"
23    , "ticky-ticky.eventlog"
24    ]
25
26
27-- Code to help print the differences between a working test and a failing test.
28diffLines :: String -> String -> String
29diffLines o n = diff 1 (lines o) (lines n)
30
31diff :: Int -> [String] -> [String] -> String
32diff _ [] [] = "Logs match"
33diff l [] (n:ns) = "Extra lines in new log at line " ++ show l ++ ":\n" ++
34    (unlines (n:ns))
35diff l (o:os) [] = "Missing lines in new log at line " ++ show l ++ ":\n" ++
36    (unlines (o:os))
37diff l (o:os) (n:ns) = if (o == n)
38                        then diff (l+1) os ns
39                        else "Different output at line " ++ show l ++ ":\n" ++
40                            "Original: " ++ o ++ "\n" ++
41                            "New:      " ++ n
42