1-------------------------------------------------------------------------------
4-- Copyright : (c) 2015 Andy Arvanitis and other contributors
7-- Maintainer : Andy Arvanitis
8-- Stability : experimental
13-------------------------------------------------------------------------------
17import Control.Applicative
23import System.Directory
25-------------------------------------------------------------------------------
26testsDir :: IO (FilePath, FilePath)
27-------------------------------------------------------------------------------
29 baseDir <- getCurrentDirectory
30 return (baseDir </> "pcc-tests", baseDir)
32-------------------------------------------------------------------------------
34-------------------------------------------------------------------------------
37 (outputDir, baseDir) <- testsDir
39 outputDirExists <- doesDirectoryExist outputDir
40 when outputDirExists $ removeDirectoryRecursive outputDir
41 createDirectory outputDir
43 let srcDir = outputDir </> "src"
44 createDirectory srcDir
46 let passingDir = baseDir </> "examples" </> "passing"
47 passingTestCases <- sort . filter (".purs" `isSuffixOf`) <$> getDirectoryContents passingDir
49 -- Auto-generate Makefile
50 setCurrentDirectory outputDir
55 let tests = filter (`notElem` skipped) passingTestCases
57 tmp <- getTemporaryDirectory
58 createDirectoryIfMissing False (tmp </> logpath)
59 outputFile <- openFile (tmp </> logpath </> logfile) WriteMode
64 forM_ tests $ \inputFile -> do
68 putStrLn $ "Compiling test " ++ inputFile ++ " ..."
69 setCurrentDirectory outputDir
70 copyFile (passingDir </> inputFile) (srcDir </> inputFile)
72 let testCaseDir = passingDir </> (takeWhile (/='.') inputFile)
73 testCaseDirExists <- doesDirectoryExist testCaseDir
74 when testCaseDirExists $ callProcess "cp" ["-R", testCaseDir, srcDir]
76 callProcess "make" ["clean"]
77 callProcess "make" ["debug"]
81 outputFile <- openFile (tmp </> logpath </> logfile) AppendMode
82 hPutStrLn outputFile ("\n" ++ inputFile ++ ":")
83 proc <- runProcess ("output" </> "bin" </> "main") [] Nothing Nothing Nothing (Just outputFile) Nothing
85 removeFile (srcDir </> inputFile)
86 when testCaseDirExists $ callProcess "rm" ["-rf", srcDir </> (takeWhile (/='.') inputFile)]
88 -- TODO: support failing test cases
90 -- let failing = baseDir </> "examples" </> "failing"
91 -- failingTestCases <- sort . filter (".purs" `isSuffixOf`) <$> getDirectoryContents failing
94 setCurrentDirectory baseDir
95 putStrLn "pcc-tests finished"
96 putStrLn $ "Total tests available: " ++ show (length passingTestCases)
97 putStrLn $ "Tests run: " ++ show (length tests)
98 putStrLn $ "Tests skipped: " ++ show (length skipped)
100-------------------------------------------------------------------------------
102-------------------------------------------------------------------------------
103repo = "git://github.com/pure11/"
105-------------------------------------------------------------------------------
107-------------------------------------------------------------------------------
123-------------------------------------------------------------------------------
124fetchPackages :: IO ()
125-------------------------------------------------------------------------------
127 mapM (callProcess "psc-package" . (\p -> ["install", p])) packages
130-------------------------------------------------------------------------------
132-------------------------------------------------------------------------------
134 [ "NumberLiterals.purs" -- unreliable float comparison, test manually
135 , "FunWithFunDeps.purs" -- requires FFI
139logpath = "purescript-output"
142logfile = "pcc-tests.out"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list