Merge pull request #78 from haskell-servant/wip-fix-test-all-script

scripts: install all of the servant ecosystem at once, for consistent dependencies
This commit is contained in:
Christian Marie 2015-05-15 15:49:03 +10:00
commit 13a8813422
5 changed files with 32 additions and 6 deletions

View file

@ -26,19 +26,19 @@ readarray -t SOURCES < "$SOURCES_TXT"
prepare_sandbox () {
$CABAL sandbox init
for s in ${SOURCES[@]} ; do
(cd "$s" && $CABAL sandbox init --sandbox=../ && $CABAL sandbox add-source .)
(cd "$s" && $CABAL sandbox init --sandbox=../.cabal-sandbox/ && $CABAL sandbox add-source .)
done
$CABAL install --enable-tests ${SOURCES[@]}
}
test_each () {
for s in ${SOURCES[@]} ; do
echo "Testing $s..."
cd "$s"
$CABAL install --only-dependencies --enable-tests
pushd "$s"
$CABAL configure --enable-tests --ghc-options="$GHC_FLAGS"
$CABAL build
$CABAL test
cd ..
popd
done
}

View file

@ -113,6 +113,8 @@ test-suite doctests
, servant
, doctest
, filemanip
, directory
, filepath
type: exitcode-stdio-1.0
main-is: test/Doctests.hs
buildable: True

View file

@ -1,14 +1,18 @@
module Main where
import Data.List (isPrefixOf)
import System.Directory
import System.FilePath
import System.FilePath.Find
import Test.DocTest
main :: IO ()
main = do
files <- find always (extension ==? ".hs") "src"
cabalMacrosFile <- getCabalMacrosFile
doctest $ [ "-isrc"
, "-optP-include"
, "-optPdist/build/autogen/cabal_macros.h"
, "-optP" ++ cabalMacrosFile
, "-XOverloadedStrings"
, "-XFlexibleInstances"
, "-XMultiParamTypeClasses"
@ -16,3 +20,10 @@ main = do
, "-XTypeOperators"
] ++ files
getCabalMacrosFile :: IO FilePath
getCabalMacrosFile = do
contents <- getDirectoryContents "dist"
let rest = "build" </> "autogen" </> "cabal_macros.h"
return $ case filter ("dist-sandbox-" `isPrefixOf`) contents of
[x] -> "dist" </> x </> rest
[] -> "dist" </> rest

View file

@ -107,6 +107,8 @@ test-suite doctests
, servant
, doctest
, filemanip
, directory
, filepath
type: exitcode-stdio-1.0
main-is: test/Doctests.hs
buildable: True

View file

@ -1,16 +1,27 @@
module Main where
import Data.List (isPrefixOf)
import System.Directory
import System.FilePath
import System.FilePath.Find
import Test.DocTest
main :: IO ()
main = do
files <- find always (extension ==? ".hs") "src"
cabalMacrosFile <- getCabalMacrosFile
doctest $ [ "-isrc"
, "-optP-include"
, "-optPdist/build/autogen/cabal_macros.h"
, "-optP" ++ cabalMacrosFile
, "-XOverloadedStrings"
, "-XFlexibleInstances"
, "-XMultiParamTypeClasses"
] ++ files
getCabalMacrosFile :: IO FilePath
getCabalMacrosFile = do
contents <- getDirectoryContents "dist"
let rest = "build" </> "autogen" </> "cabal_macros.h"
return $ case filter ("dist-sandbox-" `isPrefixOf`) contents of
[x] -> "dist" </> x </> rest
[] -> "dist" </> rest