You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Alexander Kriegisch (Jira)" <ji...@apache.org> on 2020/05/03 12:00:00 UTC

[jira] [Comment Edited] (SUREFIRE-1614) JUnit Runner that writes to System.out corrupts Surefire's STDOUT when using JUnit's Vintage Engine

    [ https://issues.apache.org/jira/browse/SUREFIRE-1614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17098393#comment-17098393 ] 

Alexander Kriegisch edited comment on SUREFIRE-1614 at 5/3/20, 11:59 AM:
-------------------------------------------------------------------------

Thanks [~tibordigana]. I configured the Apache snapshot repo and tried with a 3.0.0-SNAPSHOT. As soon as I add
{code:xml}
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>{code}
to my Failsafe configuration, the {{[WARNING] Corrupted STDOUT...}} is gone, but so is my Java agent's console output. I expect it to be printed on the system console as intended by {{System.out.println}}. Before at least it was logged in a very ugly line-by-line style with prefixes in a separate file in the reports directory. But now: Nirvana. That's not a bugfix for me. Swallowing log output is not a good idea. Sorry for the criticism, but I think before the next milestone release something should be done about it. Happy to retest if necessary. Or is there another config option I need in my plugin?


was (Author: kriegaex):
Thanks [~tibordigana]. I configured the Apache snapshot repo and tried with a 3.0.0-SNAPSHOT. As soon as I add

{code:xml}<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>{code}

to my Failsafe configuration, the {{[WARNING] Corrupted STDOUT ...}} is gone, but so is my Java agent's console output. I expect it to be printed on the system console. Before at least it was logged in a very ugly line-by-line style with prefixes in a separate file in the reports directory. But now: Nirvana. That's not a bugfix for me. Swallowing log output is not a good idea. Sorry for the criticism, but I think before the next milestone release something should be done about it. Happy to retest if necessary. Or is there another config option I need in my plugin?

> JUnit Runner that writes to System.out corrupts Surefire's STDOUT when using JUnit's Vintage Engine
> ---------------------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-1614
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1614
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: JUnit 5.x support
>    Affects Versions: 2.22.1, 3.0.0-M2
>            Reporter: Andy Wilkinson
>            Assignee: Christian Stein
>            Priority: Major
>             Fix For: 2.22.2, 3.0.0-M3
>
>         Attachments: surefire-stream-corruption-bug.zip
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When JUnit Jupiter's Vintage Engine is used to run tests written using the JUnit 4 API, output to the console from a {{TestRunner}} results in Surefire's STDOUT being corrupted:
> {noformat}
> [WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file […]{noformat}
> Note that the test runner is simply calling {{System.out}}. This is to simulate the real world setup where the runner performs some logging that ultimately results in a console appender calling {{System.out}}. The same arrangement does not cause a problem when run using JUnit 4. An initial investigation suggests that the Vintage Engine calls the custom {{TestRunner}} earlier and, it would appear, at a time when Surefire cannot tolerate output to {{System.out}}.
> I have attached a minimal project that reproduces the problem. Running {{./mvnw -Pjunit5 test}} will reproduce the corruption. Running {{./mvnw -Pjunit4 test}} will not.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)