2019-05-07 12:42:45 +03:00
|
|
|
module Main
|
|
|
|
|
|
|
|
import System
|
|
|
|
|
|
|
|
%default covering
|
|
|
|
|
|
|
|
ttimpTests : List String
|
|
|
|
ttimpTests
|
2019-05-11 22:50:51 +03:00
|
|
|
= ["basic001", "basic002", "basic003", "basic004", "basic005",
|
2019-05-26 13:34:02 +03:00
|
|
|
"basic006",
|
2019-05-25 20:39:21 +03:00
|
|
|
"dot001",
|
2019-05-07 17:06:00 +03:00
|
|
|
"eta001", "eta002",
|
2019-05-22 21:42:43 +03:00
|
|
|
"lazy001",
|
2019-05-17 15:52:09 +03:00
|
|
|
"nest001", "nest002",
|
2019-05-19 22:24:14 +03:00
|
|
|
"perf001", "perf002", "perf003",
|
2019-05-27 12:56:13 +03:00
|
|
|
"record001", "record002",
|
2019-05-27 14:15:37 +03:00
|
|
|
"rewrite001",
|
2019-05-26 13:34:02 +03:00
|
|
|
"qtt001", "qtt002", "qtt003",
|
2019-06-02 03:23:01 +03:00
|
|
|
"search001", "search002", "search003", "search004", "search005",
|
2019-05-29 13:57:07 +03:00
|
|
|
"with001"]
|
2019-05-07 12:42:45 +03:00
|
|
|
|
|
|
|
chdir : String -> IO Bool
|
|
|
|
chdir dir
|
|
|
|
= do ok <- foreign FFI_C "chdir" (String -> IO Int) dir
|
|
|
|
pure (ok == 0)
|
|
|
|
|
|
|
|
fail : String -> IO ()
|
|
|
|
fail err
|
|
|
|
= do putStrLn err
|
|
|
|
exitWith (ExitFailure 1)
|
|
|
|
|
|
|
|
runTest : String -> String -> String -> IO Bool
|
|
|
|
runTest dir prog test
|
|
|
|
= do chdir (dir ++ "/" ++ test)
|
|
|
|
putStr $ dir ++ "/" ++ test ++ ": "
|
|
|
|
system $ "sh ./run " ++ prog ++ " > output"
|
|
|
|
Right out <- readFile "output"
|
|
|
|
| Left err => do print err
|
|
|
|
pure False
|
|
|
|
Right exp <- readFile "expected"
|
|
|
|
| Left err => do print err
|
|
|
|
pure False
|
|
|
|
if (out == exp)
|
|
|
|
then putStrLn "success"
|
|
|
|
else putStrLn "FAILURE"
|
|
|
|
chdir "../.."
|
|
|
|
pure (out == exp)
|
|
|
|
|
|
|
|
main : IO ()
|
|
|
|
main
|
|
|
|
= do [_, ttimp] <- getArgs
|
|
|
|
| _ => do putStrLn "Usage: runtests [ttimp path]"
|
|
|
|
ttimps <- traverse (runTest "ttimp" ttimp) ttimpTests
|
|
|
|
-- blods <- traverse (runTest "blodwen" blodwen) blodwenTests
|
|
|
|
if (any not ttimps)
|
|
|
|
then exitWith (ExitFailure 1)
|
|
|
|
else exitWith ExitSuccess
|
|
|
|
|