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    , "ticky-begin-sample.eventlog"
25    ]
26
27
28-- Code to help print the differences between a working test and a failing test.
29diffLines :: String -> String -> String
30diffLines o n = diff 1 (lines o) (lines n)
31
32diff :: Int -> [String] -> [String] -> String
33diff _ [] [] = "Logs match"
34diff l [] (n:ns) = "Extra lines in new log at line " ++ show l ++ ":\n" ++
35    (unlines (n:ns))
36diff l (o:os) [] = "Missing lines in new log at line " ++ show l ++ ":\n" ++
37    (unlines (o:os))
38diff l (o:os) (n:ns) = if (o == n)
39                        then diff (l+1) os ns
40                        else "Different output at line " ++ show l ++ ":\n" ++
41                            "Original: " ++ o ++ "\n" ++
42                            "New:      " ++ n
43