-
Notifications
You must be signed in to change notification settings - Fork 2
/
Setup.hs
30 lines (27 loc) · 946 Bytes
/
Setup.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- @+leo-ver=4-thin
-- @+node:gcross.20090530015605.29:@thin Setup.hs
-- @@language Haskell
import Control.Monad
import Distribution.Simple
import System.Exit
import System.IO
import System.Process
import Text.Printf
main = defaultMainWithHooks (simpleUserHooks {runTests = runzeTests})
runzeTests _ _ _ _= do
putStrLn "Checking for required modules..."
found <- forM ["test-framework","test-framework-hunit"] $ \package_name -> do
putStr $ printf "Checking for package %s... " package_name
hFlush stdout
error_code <- system $ printf "ghc-pkg field %s version" package_name
return (error_code == ExitSuccess)
when ((not.and) found) $ do
putStrLn "One or more packages needed for testing was not found."
exitWith $ ExitFailure 1
putStrLn ""
putStrLn "Running tests..."
putStrLn ""
system "runhaskell -i. -i./tests tests/runtests.hs"
return ()
-- @-node:gcross.20090530015605.29:@thin Setup.hs
-- @-leo