git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: dump pcc test execution output to tmp file
07969a1Andy Arvanitis
pcc/TestMain.hs+15−1
@@ -19,6 +19,7 @@ import Control.Monad
19
19
20import System.Process
20import System.Process
21import System.FilePath
21import System.FilePath
22+import System.IO
22import System.Directory
23import System.Directory
23
24
24-------------------------------------------------------------------------------
25-------------------------------------------------------------------------------
@@ -53,6 +54,11 @@ main = do
53
54
54 let tests = filter (`notElem` skipped) passingTestCases
55 let tests = filter (`notElem` skipped) passingTestCases
55
56
57+ tmp <- getTemporaryDirectory
58+ createDirectoryIfMissing False (tmp </> logpath)
59+ outputFile <- openFile (tmp </> logpath </> logfile) WriteMode
60+ hClose outputFile
61+
56 -- Run the tests
62 -- Run the tests
57 --
63 --
58 forM_ tests $ \inputFile -> do
64 forM_ tests $ \inputFile -> do
@@ -72,7 +78,9 @@ main = do
72 --
78 --
73 -- Run C++ files
79 -- Run C++ files
74 --
80 --
75− callProcess ("output" </> "bin" </> "main") []
81+ outputFile <- openFile (tmp </> logpath </> logfile) AppendMode
82+ hPutStrLn outputFile ("\n" ++ inputFile ++ ":")
83+ proc <- runProcess ("output" </> "bin" </> "main") [] Nothing Nothing Nothing (Just outputFile) Nothing
76
84
77 removeFile (srcDir </> inputFile)
85 removeFile (srcDir </> inputFile)
78 when testCaseDirExists $ callProcess "rm" ["-rf", srcDir </> (takeWhile (/='.') inputFile)]
86 when testCaseDirExists $ callProcess "rm" ["-rf", srcDir </> (takeWhile (/='.') inputFile)]
@@ -126,3 +134,9 @@ skipped =
126 [ "NumberLiterals.purs" -- unreliable float comparison, test manually
134 [ "NumberLiterals.purs" -- unreliable float comparison, test manually
127 , "FunWithFunDeps.purs" -- requires FFI
135 , "FunWithFunDeps.purs" -- requires FFI
128 ]
136 ]
137+
138+logpath :: FilePath
139+logpath = "purescript-output"
140+
141+logfile :: FilePath
142+logfile = "pcc-tests.out"