Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-q option behaves very badly #61

Open
benmccann opened this issue Nov 19, 2014 · 1 comment
Open

-q option behaves very badly #61

benmccann opened this issue Nov 19, 2014 · 1 comment

Comments

@benmccann
Copy link
Contributor

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.

@szeiger
Copy link
Contributor

szeiger commented Nov 19, 2014

-q requires parallel test runs to be disabled. Also see the discussion in #46 about how to make this work with parallel tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants