Commit ff08346c authored by Edward Z. Yang's avatar Edward Z. Yang Committed by GitHub
Browse files

Merge pull request #3942 from 23Skidoo/issue-3938

cabal.project: Add a constraint on unix.
parents fc26cef2 2ed454ee
......@@ -55,9 +55,8 @@ import GHC.IO.Encoding.Failure
#endif
#if defined(mingw32_HOST_OS) || MIN_VERSION_directory(1,2,3)
import Prelude hiding (ioError)
import System.Directory (doesDirectoryExist)
import System.IO.Error (ioError, mkIOError, doesNotExistErrorType)
import qualified System.Directory as Dir
import qualified System.IO.Error as IOError
#endif
-- | Generic merging utility. For sorted input lists this is a full outer join.
......@@ -244,9 +243,9 @@ tryCanonicalizePath :: FilePath -> IO FilePath
tryCanonicalizePath path = do
ret <- canonicalizePath path
#if defined(mingw32_HOST_OS) || MIN_VERSION_directory(1,2,3)
exists <- liftM2 (||) (doesFileExist ret) (doesDirectoryExist ret)
exists <- liftM2 (||) (doesFileExist ret) (Dir.doesDirectoryExist ret)
unless exists $
ioError $ mkIOError doesNotExistErrorType "canonicalizePath"
IOError.ioError $ IOError.mkIOError IOError.doesNotExistErrorType "canonicalizePath"
Nothing (Just ret)
#endif
return ret
......
......@@ -43,7 +43,6 @@ Extra-Source-Files:
tests/IntegrationTests/custom/custom_dep/custom/A.hs
tests/IntegrationTests/custom/custom_dep/custom/Setup.hs
tests/IntegrationTests/custom/custom_dep/custom/custom.cabal
tests/IntegrationTests/custom/plain.err
tests/IntegrationTests/custom/plain.sh
tests/IntegrationTests/custom/plain/A.hs
tests/IntegrationTests/custom/plain/Setup.hs
......
. ./common.sh
# On Travis OSX, Cabal shipped with GHC 7.8 does not work
# with error "setup: /usr/bin/ar: permission denied"; see
# also https://github.com/haskell/cabal/issues/3938
# This is a hack to make the test not run in this case.
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
require_ghc_ge 710
fi
cd custom_dep
cabal sandbox init
cabal sandbox add-source custom
......
. ./common.sh
# On Travis OSX, Cabal shipped with GHC 7.8 does not work
# with error "setup: /usr/bin/ar: permission denied"; see
# also https://github.com/haskell/cabal/issues/3938
# This is a hack to make the test not run in this case.
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
require_ghc_ge 710
fi
cd plain
cabal configure
cabal build
cabal configure 2> log
grep Custom log
cabal build 2> log
grep Custom log
......@@ -14,6 +14,8 @@ import Distribution.Package
import Distribution.PackageDescription
import Distribution.InstalledPackageInfo (InstalledPackageInfo)
import Distribution.Simple.Setup (toFlag)
import Distribution.Simple.Compiler
import Distribution.System
import Distribution.Version
import Distribution.Verbosity
import Distribution.Text
......@@ -130,8 +132,17 @@ testExceptionInBuildStep config = do
testSetupScriptStyles :: ProjectConfig -> (String -> IO ()) -> Assertion
testSetupScriptStyles config reportSubCase = do
reportSubCase (show SetupCustomExplicitDeps)
(plan1, res1) <- executePlan =<< planProject testdir1 config
reportSubCase (show SetupCustomExplicitDeps)
plan0@(_,_,sharedConfig,_,_) <- planProject testdir1 config
let isOSX (Platform _ OSX) = True
isOSX _ = False
-- Skip the Custom tests when the shipped Cabal library is buggy
unless (isOSX (pkgConfigPlatform sharedConfig)
&& compilerVersion (pkgConfigCompiler sharedConfig) < mkVersion [7,10]) $ do
(plan1, res1) <- executePlan plan0
(pkg1, _) <- expectPackageInstalled plan1 res1 pkgidA
elabSetupScriptStyle pkg1 @?= SetupCustomExplicitDeps
hasDefaultSetupDeps pkg1 @?= Just False
......
packages: Cabal/ cabal-install/
constraints: unix >= 2.7.1.0
-- Uncomment to allow picking up extra local unpacked deps:
--optional-packages: */
......
......@@ -9,6 +9,8 @@
. ./travis-common.sh
CABAL_STORE_DB="${HOME}/.cabal/store/ghc-${GHCVER}/package.db"
CABAL_LOCAL_DB="${PWD}/dist-newstyle/packagedb/ghc-${GHCVER}"
CABAL_BDIR="${PWD}/dist-newstyle/build/Cabal-${CABAL_VERSION}"
CABAL_INSTALL_BDIR="${PWD}/dist-newstyle/build/cabal-install-${CABAL_VERSION}"
CABAL_INSTALL_SETUP="${CABAL_INSTALL_BDIR}/setup/setup"
......@@ -53,7 +55,7 @@ timed cabal new-build Cabal Cabal:package-tests Cabal:unit-tests
# http://stackoverflow.com/questions/14970663/why-doesnt-bash-flag-e-exit-when-a-subshell-fails
# Run tests
(cd Cabal && timed ${CABAL_BDIR}/build/package-tests/package-tests $TEST_OPTIONS) || exit $?
(export CABAL_PACKAGETESTS_DB_STACK="clear:global:${CABAL_STORE_DB}:${CABAL_LOCAL_DB}"; cd Cabal && timed ${CABAL_BDIR}/build/package-tests/package-tests $TEST_OPTIONS) || exit $?
(cd Cabal && timed ${CABAL_BDIR}/build/unit-tests/unit-tests $TEST_OPTIONS) || exit $?
# Run haddock (hack: use the Setup script from package-tests!)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment