on master help sign in
Normalise newlines in runtest

This prevents different platforms giving different results and breaking the comparison, which is currently breaking tests on some machines.

commitb0425315b4f07a7873cae2e7340709cc797f58f9 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateSat 30 Jan 2016, 13:53 (11 years ago) parentf2e6671
1 file changed+9−4
test/runtest.hs+9−4
test/runtest.hs+9−4
@@ -105,10 +105,6 @@ runTest conf test = do
105105 -- don't touch the current directory as we want to run these things
106106 -- in parallel in the future
107107 let inTest s = test ++ "/" ++ s
108− -- just pretend that backslashes are slashes for comparison
109− -- purposes to avoid path problems, so don't write any tests
110− -- that depend on that distinction in other contexts
111− let norm s = map (\c -> if c=='\\' then '/' else c) s
112108 t1 <- getCurrentTime
113109 (exitCode, output) <- runInShell test (idrOpts conf)
114110 t2 <- getCurrentTime
@@ -128,6 +124,15 @@ runTest conf test = do
128124 let dt = diffUTCTime t2 t1
129125 putStrLn $ "Duration of " ++ test ++ " was " ++ show dt
130126 return res
127+ where
128+ -- just pretend that backslashes are slashes for comparison
129+ -- purposes to avoid path problems, so don't write any tests
130+ -- that depend on that distinction in other contexts.
131+ -- Also rewrite newlines for consistency.
132+ norm ('\r':'\n':xs) = '\n' : norm xs
133+ norm ('\\':xs) = '/' : norm xs
134+ norm (x : xs) = x : norm xs
135+ norm [] = []
131136
132137printStats :: Config -> [Status] -> IO ()
133138printStats conf stats = do