Commit 158cc06e authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Port exec/configures_cabal_to_use_sandbox to use new test suite



Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 6d3a00a1
. ./common.sh
cabal sandbox delete > /dev/null
cabal exec my-executable && die "Unexpectedly found executable"
cabal sandbox init > /dev/null
cabal install > /dev/null
# The library should not be available outside the sandbox
"$GHC_PKG" list | grep -v "my-0.1"
# When run inside 'cabal-exec' the 'sandbox hc-pkg list' sub-command
# should find the library.
cabal exec sh -- -c 'cd subdir && "$CABAL" sandbox hc-pkg list' | grep "my-0.1"
import Test.Cabal.Prelude
import Data.Maybe
main = cabalTest $ do
withPackageDb $ do
withSandbox $ do
fails $ cabal "exec" ["my-executable"]
cabal "install" []
-- The library should not be available outside the sandbox
ghcPkg' "list" [] >>= assertOutputDoesNotContain "my-0.1"
-- When run inside 'cabal-exec' the 'sandbox hc-pkg list' sub-command
-- should find the library.
env <- getTestEnv
-- TODO: libify me
let cabal_path = fromMaybe (error "No cabal-install path configured")
(testCabalInstallPath env)
cabal' "exec" ["sh", "--", "-c"
, "cd subdir && " ++ show cabal_path ++
-- TODO: Ugh. Test abstractions leaking
-- through
" --sandbox-config-file " ++ show (testSandboxConfigFile env) ++
" sandbox hc-pkg list"]
>>= assertOutputContains "my-0.1"
Supports Markdown
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