on master help sign in
Merge pull request #2922 from jfdm/integrate-test-runner-with-cabal

Integrate test suite with cabal

commit85b6c78b9d54a7c85cca2c1530060fc2046832bd authorNiklas Larsson <metaniklas@gmail.com> dateSun 31 Jan 2016, 23:43 (11 years ago) parent00ab4892fdccaa
2 files changed+23−2
idris.cabal+18 test/runtest.hs+5−2
idris.cabal+18
@@ -1046,6 +1046,24 @@ Executable idris
10461046 ghc-prof-options: -auto-all -caf-all
10471047 ghc-options: -threaded -rtsopts -funbox-strict-fields
10481048
1049+Test-suite regression-and-sanity-tests
1050+ Type: exitcode-stdio-1.0
1051+ Main-is: runtest.hs
1052+ hs-source-dirs: test
1053+
1054+ Build-depends: idris
1055+ , base
1056+ , containers
1057+ , process
1058+ , time
1059+ , filepath
1060+ , directory
1061+ , haskeline >= 0.7
1062+ , transformers
1063+
1064+ ghc-prof-options: -auto-all -caf-all
1065+ ghc-options: -threaded -rtsopts -funbox-strict-fields
1066+
10491067Executable idris-codegen-c
10501068 Main-is: Main.hs
10511069 hs-source-dirs: codegen/idris-codegen-c
test/runtest.hs+5−2
@@ -51,8 +51,8 @@ checkTestName d = (all isDigit $ take 3 $ reverse d)
5151
5252enumTests :: IO [String]
5353enumTests = do
54− cd <- getCurrentDirectory
55− dirs <- getDirectoryContents cd
54+ cwd <- getCurrentDirectory
55+ dirs <- getDirectoryContents cwd
5656 return $ sort $ filter checkTestName dirs
5757
5858parseFlag :: String -> Maybe Flag
@@ -202,6 +202,9 @@ setPath conf = do
202202
203203main = do
204204 hSetBuffering stdout LineBuffering
205+ withCabal <- doesDirectoryExist "test"
206+ when withCabal $ do
207+ setCurrentDirectory "test"
205208 args <- getArgs
206209 conf <- parseArgs args
207210 setPath conf