cabal test does not tail standard output of the running test executable #928

Closed
bos opened this Issue May 24, 2012 · 5 comments

4 participants

@bos
Haskell member

(Imported from Trac #938, reported by fushunpoon on 2012-04-10)

Problem:

cabal test does not tail standard output of the running test executable. Instead, any output from the executable is output right at the end of the test process in one batch.

Motivation:

It is incredibly useful to have cabal test tail the stdout of the test executable currently being executed such that CI tools such as TeamCity? can be made to record the time it takes to run individual tests.

Reproduction:

Run the following simple executable as a test executable with
cabal test --show-details=always

module Main where
import Control.Concurrent
delay = 5000000
main = do
putStrLn "First message"
threadDelay delay
putStrLn "Second message"
threadDelay delay
putStrLn "Third message"
threadDelay delay
Instead of outputting each line ("First/Second/Third message") five seconds after another, all three lines are output along with test result reporting all at once at the end of the test suite.

@ttuegel ttuegel was assigned May 24, 2012
@cloudhead

This makes it especially difficult to debug issues when a thread is blocked, as it will just hang there with no output.

@tibbe
Haskell member

I recently added a cross-platform createPipe function in https://github.com/haskell/cabal/blob/master/Cabal/tests/Distribution/Compat/CreatePipe.hsc. We could use that to tail stdout as it's written while at the same time writing it to a file (today we only do the latter).

@ttuegel
Haskell member

Awesome, that is exactly what I was missing when I wrote the offending code!

@tibbe
Haskell member

Feel free to move createPipe to somewhere more suitable.

@ttuegel
Haskell member

As of #1727 you can cabal test --show-details=streaming.

@ttuegel ttuegel closed this Mar 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment