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.
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?
cd /path/to/sandbox
cabal install --enable-tests A B C
Problems:
--show-details=always
to cabal install
.cabal install A
earlier, A won't get rebuilt and the tests won't get run.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:
In the sandbox cabal.config
, add the line tests: True
.
Problems:
Cabal is really missing functionality here. My plan is to generalize cabal so it has less (or no) concept of a "current package". Right now lots of commands assume that you're in a directory with a .cabal file and you want to do thing to that package. This is less often the case for large, multi-package projects as you've seen.
What I want is for cabal to take a list of targets for most commands, such as build
, test
, bench
, etc. You can the run tests from several packages by
cabal test --show-details=always \
pkg-dir1:some-test1 pkg-dir1:some-test2 pkg-dir2
(The above example shows that it should be possible to specify just some sections of a package as well.)
I realize that this doesn't help you much now, but at least you know which direction we're moving in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With