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

Write output from JUnit ConsoleRunner when process is terminated #7799

merged 3 commits into from May 31, 2019


None yet
2 participants
Copy link

commented May 24, 2019


Pants enforces test timeouts for JVM JUnit tests by terminating the JVM process (usually sending SIGINT). When this happens today, test output is not consistently written out. In particular, XML output from AntJunitXmlReportListener will not be written.

Unfortunately, this means test tooling that relies on this XML cannot accurately report test results when the global timeout (usually set with --test-junit-timeout-default) is reached.


Add a JVM shutdown hook to write out test results on JVM termination.


JUnit test results are available even when Pants times out on a given test run.


This branch also makes the following changes in support of this:

  • Adds close() to the StreamSource interface to ensure we can close output streams before using their values, and uses it
  • Modifies ConsoleRunnerImpl to improve testability (as might be expected, it's tricky to test behavior triggered on SIGINT)
  • Generalizes and simplifies ShutdownListener so that it:
    • Supports parallel test execution
    • Tracks result state across the entire lifecycle
    • Delegates its work instead of extending ConsoleListener
  • Adjusts the counting of tests in AntJunitXmlReportListener to be accurate in the face of abnormal termination

Michael Solomon added some commits May 24, 2019

@stuhood stuhood requested review from jsirois, cheister and wisechengyi and removed request for wisechengyi May 29, 2019

Michael Solomon

@stuhood stuhood merged commit 3c21b52 into pantsbuild:master May 31, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

This comment has been minimized.

Copy link

commented May 31, 2019


stuhood added a commit to twitter/pants that referenced this pull request May 31, 2019

stuhood added a commit that referenced this pull request Jun 2, 2019

Bump to latest junit-runner (#7830)
Bump to latest junit-runner, including changes from #7799.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.