git.iko.soy/typeable/servant
on master help sign in
Merge pull request #78 from haskell-servant/wip-fix-test-all-script

scripts: install all of the servant ecosystem at once, for consistent dependencies

commit13a88134226fded3b9d4d721afc99385be1de44f authorChristian Marie <christian@ponies.io> dateFri 15 May 2015, 15:49 (11 years ago) parentc87b846b5e558f
5 files changed+32−6
scripts/test-all.sh+4−4 servant-server/servant-server.cabal+2 servant-server/test/Doctests.hs+12−1 servant/servant.cabal+2 servant/test/Doctests.hs+12−1
scripts/test-all.sh+4−4
@@ -26,19 +26,19 @@ readarray -t SOURCES < "$SOURCES_TXT"
2626prepare_sandbox () {
2727 $CABAL sandbox init
2828 for s in ${SOURCES[@]} ; do
29− (cd "$s" && $CABAL sandbox init --sandbox=../ && $CABAL sandbox add-source .)
29+ (cd "$s" && $CABAL sandbox init --sandbox=../.cabal-sandbox/ && $CABAL sandbox add-source .)
3030 done
31+ $CABAL install --enable-tests ${SOURCES[@]}
3132}
3233
3334test_each () {
3435 for s in ${SOURCES[@]} ; do
3536 echo "Testing $s..."
36− cd "$s"
37− $CABAL install --only-dependencies --enable-tests
37+ pushd "$s"
3838 $CABAL configure --enable-tests --ghc-options="$GHC_FLAGS"
3939 $CABAL build
4040 $CABAL test
41− cd ..
41+ popd
4242 done
4343}
4444
servant-server/servant-server.cabal+2
@@ -113,6 +113,8 @@ test-suite doctests
113113 , servant
114114 , doctest
115115 , filemanip
116+ , directory
117+ , filepath
116118 type: exitcode-stdio-1.0
117119 main-is: test/Doctests.hs
118120 buildable: True
servant-server/test/Doctests.hs+12−1
@@ -1,14 +1,18 @@
11module Main where
22
3+import Data.List (isPrefixOf)
4+import System.Directory
5+import System.FilePath
36import System.FilePath.Find
47import Test.DocTest
58
69main :: IO ()
710main = do
811 files <- find always (extension ==? ".hs") "src"
12+ cabalMacrosFile <- getCabalMacrosFile
913 doctest $ [ "-isrc"
1014 , "-optP-include"
11− , "-optPdist/build/autogen/cabal_macros.h"
15+ , "-optP" ++ cabalMacrosFile
1216 , "-XOverloadedStrings"
1317 , "-XFlexibleInstances"
1418 , "-XMultiParamTypeClasses"
@@ -16,3 +20,10 @@ main = do
1620 , "-XTypeOperators"
1721 ] ++ files
1822
23+getCabalMacrosFile :: IO FilePath
24+getCabalMacrosFile = do
25+ contents <- getDirectoryContents "dist"
26+ let rest = "build" </> "autogen" </> "cabal_macros.h"
27+ return $ case filter ("dist-sandbox-" `isPrefixOf`) contents of
28+ [x] -> "dist" </> x </> rest
29+ [] -> "dist" </> rest
servant/servant.cabal+2
@@ -107,6 +107,8 @@ test-suite doctests
107107 , servant
108108 , doctest
109109 , filemanip
110+ , directory
111+ , filepath
110112 type: exitcode-stdio-1.0
111113 main-is: test/Doctests.hs
112114 buildable: True
servant/test/Doctests.hs+12−1
@@ -1,16 +1,27 @@
11module Main where
22
3+import Data.List (isPrefixOf)
4+import System.Directory
5+import System.FilePath
36import System.FilePath.Find
47import Test.DocTest
58
69main :: IO ()
710main = do
811 files <- find always (extension ==? ".hs") "src"
12+ cabalMacrosFile <- getCabalMacrosFile
913 doctest $ [ "-isrc"
1014 , "-optP-include"
11− , "-optPdist/build/autogen/cabal_macros.h"
15+ , "-optP" ++ cabalMacrosFile
1216 , "-XOverloadedStrings"
1317 , "-XFlexibleInstances"
1418 , "-XMultiParamTypeClasses"
1519 ] ++ files
1620
21+getCabalMacrosFile :: IO FilePath
22+getCabalMacrosFile = do
23+ contents <- getDirectoryContents "dist"
24+ let rest = "build" </> "autogen" </> "cabal_macros.h"
25+ return $ case filter ("dist-sandbox-" `isPrefixOf`) contents of
26+ [x] -> "dist" </> x </> rest
27+ [] -> "dist" </> rest