summaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2011-09-19 13:14:01 +0000
committerhallgren <hallgren@chalmers.se>2011-09-19 13:14:01 +0000
commit343e852bfe9ef4c63d25742054f6e9463a78d1ac (patch)
tree50d3b2c782939edd8e7d276be4256bfc177db6f7 /Setup.hs
parentc8c81f77f7fa0e905f22143ef61412d856f7847d (diff)
test suite: Don't fail because of the Win32/Unix text file incompatibility.
Diffstat (limited to 'Setup.hs')
-rw-r--r--Setup.hs20
1 files changed, 12 insertions, 8 deletions
diff --git a/Setup.hs b/Setup.hs
index cbf710ad0..d136c943c 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -156,20 +156,24 @@ testRGL args _ pkg lbi = do
putStr (in_file++" ... ")
hFlush stdout
res <- runTest in_file out_file gold_file
- putStrLn (if res then "OK" else "FAIL")
+ putStrLn res
else return ()
else walk fpath
runTest in_file out_file gold_file = do
- inp <- readFile in_file
- out <- readProcess (default_gf pkg lbi) ["-run"] inp
- writeFile out_file out
+ writeFile out_file =<< readProcess (default_gf pkg lbi) ["-run"] =<< readFile in_file
exists <- doesFileExist gold_file
if exists
- then do gold <- readFile gold_file
- return $! (out == gold)
- else return False
-
+ then do out <- compatReadFile out_file
+ gold <- compatReadFile gold_file
+ return $! if out == gold then "OK" else "FAIL"
+ else return "MISSING GOLD"
+
+ -- Avoid failures caused by Win32/Unix text file incompatibility
+ compatReadFile path =
+ do h <- openFile path ReadMode
+ hSetNewlineMode h universalNewlineMode
+ hGetContents h
rgl_src_dir = "lib" </> "src"
rgl_dst_dir lbi = buildDir lbi </> "rgl"