Let's say I have three of my own packages, A B & C, with dependencies on lots of additional packages in Hackage. I'm using cabal 1.18.
- C depends on A & B.
- B depends on A.
- A & B have test suites.
I set up the sandbox like this:
cd /path/to/sandbox
cabal sandbox init
cabal sandbox add-source /path/to/A
cabal sandbox add-source /path/to/B
cabal sandbox add-source /path/to/C
I want to build all the packages, run all test suites on my packages but not dependency packages, showing full test output. What's the best way to do that?
Option 1
cd /path/to/sandbox
cabal install --enable-tests A B C
Problems:
- There's no way to pass
--show-details=always
tocabal install
. - Test output is hidden in a log file and not shown.
- If the user happened to do
cabal install A
earlier, A won't get rebuilt and the tests won't get run.
Option 2
cd /path/to/A
cabal sandbox init --sandbox=/path/to/sandbox/.cabal-sandbox
cd /path/to/B
cabal sandbox init --sandbox=/path/to/sandbox/.cabal-sandbox
cd /path/to/A
cabal configure --enable-tests
cabal test --show-details=always
cd /path/to/B
cabal configure --enable-tests
cabal test --show-details=always
cabal install C
Problems:
- This causes A and B libraries to be unnecessarily rebuilt.
Option 3
In the sandbox cabal.config
, add the line tests: True
.
Problems:
- This will cause tests to run for all dependent packages from Hackage, which is very slow and fails in some cases.
cabal test
. – Temporal