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

Port sandbox-reinstalls to cabal-testsuite



Needed to stop logging dir change to stdout
to make test output deterministic.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent e0b1f432
......@@ -1391,7 +1391,7 @@ installUnpackedPackage verbosity installLock numJobs
-- Path to the optional log file.
mLogPath <- maybeLogPath
logDirChange (maybe putStr appendFile mLogPath) workingDir $ do
logDirChange (maybe (const (return ())) appendFile mLogPath) workingDir $ do
-- Configure phase
onFailure ConfigureFailed $ do
when (numJobs > 1) $ notice verbosity $
......
......@@ -46,11 +46,6 @@ Extra-Source-Files:
tests/IntegrationTests/freeze/freezes_transitive_dependencies.sh
tests/IntegrationTests/freeze/my.cabal
tests/IntegrationTests/freeze/runs_without_error.sh
tests/IntegrationTests/sandbox-reinstalls/p/Main.hs
tests/IntegrationTests/sandbox-reinstalls/p/p.cabal
tests/IntegrationTests/sandbox-reinstalls/q/Q.hs
tests/IntegrationTests/sandbox-reinstalls/q/q.cabal
tests/IntegrationTests/sandbox-reinstalls/reinstall-modified-source.sh
tests/IntegrationTests2/build/keep-going/cabal.project
tests/IntegrationTests2/build/keep-going/p/P.hs
tests/IntegrationTests2/build/keep-going/p/p.cabal
......
. ./common.sh
cd p
cabal sandbox init
cabal sandbox add-source ../q
cabal install --only-dependencies
cabal run p -v0 | grep -q '^message$' \
|| die "Expected \"message\" in p's output."
sleep 1
# Append to the string that p imports from q and prints:
echo ' ++ " updated"' >> ../q/Q.hs
cabal run p -v0 | grep -q '^message updated$' \
|| die "Expected \"message updated\" in p's output."
module Q where
message :: String
message = "message updated"
# cabal sandbox init
Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal sandbox add-source
# cabal install
Resolving dependencies...
Configuring q-1.0...
Preprocessing library for q-1.0..
Building library for q-1.0..
Installing library in <PATH>
Installed q-1.0
# cabal run
message
# cabal run
In order, the following will be installed:
q-1.0 (reinstall)
message updated
import Test.Cabal.Prelude
main = cabalTest $ do
withSourceCopy . withDelay . withDirectory "p" . withSandbox $ do
cabal_sandbox "add-source" ["../q"]
cabal "install" ["--only-dependencies"]
recordMode RecordAll $ cabal "run" ["p", "-v0"]
delay
copySourceFileTo "../q/Q.hs.in2" "../q/Q.hs"
recordMode RecordAll $ cabal "run" ["p", "-v0"]
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