Skip to content

-q option behaves very badly #61

@benmccann

Description

@benmccann

This bug was originally filed with SBT and was tracked down to being an issue in junit-interface.

The -q option makes the SBT console disappear. I've created a repository that reproduces this bug.

The console prompt should reappear when the tests have finished running:

[success] Total time: 0 s, completed Oct 30, 2014 5:34:15 PM
>

However, due to this bug, often times you won't see the prompt appear after the tests have run:

[success] Total time: 0 s, completed Oct 30, 2014 5:41:37 PM

This is super annoying because it was happening to me nearly every time I run my tests making me constantly kill and restart the SBT console. It happens much less with the sample repository than my real project (I'm guessing because there are fewer tests so I hit whatever race condition less often). I added the -q option following a suggestion from @jroper on the Play mailing list and not really examining what the option does. When I try it now I find that I can see absolutely no difference in the output with the option on or off and so the option seems to be rather broken as it is having no effect.

@retronym suggested the following:

At a minimum, it would be good to detect when it is being used in a parallel test run and try to fail fast.

I suppose junit-interface could to install a custom OutputStream that multiplexes across a ThreadLocal[OutputStream]. The test started event could increment an AtomicInteger counter, test finished would decrement. When the counter goes from 0 -> 1, this multiplexing stream would be installed as System.out, conversely when it goes from 1 -> 0 the original could be restored.

Googling ThreadLocalOutputStream yields a similar approach taken in startup-java-fast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions