1
0
forked from GitHub/gf-core

test suite: Don't fail because of the Win32/Unix text file incompatibility.

This commit is contained in:
hallgren
2011-09-19 13:14:01 +00:00
parent c8c81f77f7
commit 343e852bfe

View File

@@ -156,20 +156,24 @@ testRGL args _ pkg lbi = do
putStr (in_file++" ... ") putStr (in_file++" ... ")
hFlush stdout hFlush stdout
res <- runTest in_file out_file gold_file res <- runTest in_file out_file gold_file
putStrLn (if res then "OK" else "FAIL") putStrLn res
else return () else return ()
else walk fpath else walk fpath
runTest in_file out_file gold_file = do runTest in_file out_file gold_file = do
inp <- readFile in_file writeFile out_file =<< readProcess (default_gf pkg lbi) ["-run"] =<< readFile in_file
out <- readProcess (default_gf pkg lbi) ["-run"] inp
writeFile out_file out
exists <- doesFileExist gold_file exists <- doesFileExist gold_file
if exists if exists
then do gold <- readFile gold_file then do out <- compatReadFile out_file
return $! (out == gold) gold <- compatReadFile gold_file
else return False 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_src_dir = "lib" </> "src"
rgl_dst_dir lbi = buildDir lbi </> "rgl" rgl_dst_dir lbi = buildDir lbi </> "rgl"