From 07f8b6a28af36ae176b4188d08b822c289bae0b1 Mon Sep 17 00:00:00 2001 From: Christian Marie Date: Thu, 14 May 2015 12:35:35 +1000 Subject: [PATCH 1/2] scripts: install all of the servant ecosystem at once, for consistent dependencies --- scripts/test-all.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/test-all.sh b/scripts/test-all.sh index 61eef116..3e7d0465 100755 --- a/scripts/test-all.sh +++ b/scripts/test-all.sh @@ -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 } From 0d47f4527b87ddc590cf039fe12f22be0e7736e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Hahn?= Date: Thu, 14 May 2015 19:47:39 +0800 Subject: [PATCH 2/2] fix doctests for cabal-install-1.18 --- servant-server/servant-server.cabal | 2 ++ servant-server/test/Doctests.hs | 13 ++++++++++++- servant/servant.cabal | 2 ++ servant/test/Doctests.hs | 13 ++++++++++++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/servant-server/servant-server.cabal b/servant-server/servant-server.cabal index f4d34df1..6c325517 100644 --- a/servant-server/servant-server.cabal +++ b/servant-server/servant-server.cabal @@ -113,6 +113,8 @@ test-suite doctests , servant , doctest , filemanip + , directory + , filepath type: exitcode-stdio-1.0 main-is: test/Doctests.hs buildable: True diff --git a/servant-server/test/Doctests.hs b/servant-server/test/Doctests.hs index c63a6d85..5bf9c91f 100644 --- a/servant-server/test/Doctests.hs +++ b/servant-server/test/Doctests.hs @@ -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 diff --git a/servant/servant.cabal b/servant/servant.cabal index 8c237a13..c376c9ac 100644 --- a/servant/servant.cabal +++ b/servant/servant.cabal @@ -107,6 +107,8 @@ test-suite doctests , servant , doctest , filemanip + , directory + , filepath type: exitcode-stdio-1.0 main-is: test/Doctests.hs buildable: True diff --git a/servant/test/Doctests.hs b/servant/test/Doctests.hs index 059292c0..63d842f0 100644 --- a/servant/test/Doctests.hs +++ b/servant/test/Doctests.hs @@ -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