Cabal: Is there `--show-details` analog for `new-test` command?

Created on 15 Sep 2017  Â·  8Comments  Â·  Source: haskell/cabal

Is there --show-details analog for new-test command?

> cabal new-test --show-details=streaming
cabal: unrecognized 'new-test' option `--show-details=streaming'
nix-local-build enhancement

Most helpful comment

It's probably not implemented yet.

I think that we should not implement this. Instead, we should just make the --show-details=streaming behavior the only one supported by new-test.

It was a huge mistake to try to support logging this way in Cabal itself. If you are doing logging during build, it is almost certainly because you are doing CI, but Cabal is not a CI tool! If you want test logging, there are other, better tools. Test frameworks tend to misbehave unless run with --show-details=streaming; we should never have tried to do anything else.

All 8 comments

It's probably not implemented yet.

/cc @ttuegel @fgaz

Yeah, we don't have support for test and bench specific flags in new-build yet. See #4643 too.
It's probably just a matter of passing them to the right function, but I have yet to investigate.

It's probably not implemented yet.

I think that we should not implement this. Instead, we should just make the --show-details=streaming behavior the only one supported by new-test.

It was a huge mistake to try to support logging this way in Cabal itself. If you are doing logging during build, it is almost certainly because you are doing CI, but Cabal is not a CI tool! If you want test logging, there are other, better tools. Test frameworks tend to misbehave unless run with --show-details=streaming; we should never have tried to do anything else.

+1 to defaulting to streaming for new-test, whether or not it's the only behaviour. It's happened more than once now that I've misdiagnosed slow tests as a hang because of this.

Incidentally, this question has hit StackExchange today:
https://stackoverflow.com/q/51488620/946226

A simple solution for the time being:

cabal new-build integration

$(find dist-newstyle -name integration -executable -type f) --color=always

… assuming your test suite is named integration.

/cc @harendra-kumar

@michalrus yes, manually running the test executable works, I do it sometimes, its just a bit inconvenient. However, it does not work in a generic CI script (e.g. I use https://github.com/harendra-kumar/packcheck) where the test suite names are not known. We can perhaps ask cabal to list the test suite names or parse the cabal file, but then we are just building a poor workaround for the functionality ourselves.

@michalrus if you want to run a single test you can also use cabal new-run integration -- --color=always

Was this page helpful?
0 / 5 - 0 ratings