-
-
Notifications
You must be signed in to change notification settings - Fork 631
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write output from JUnit ConsoleRunner when process is terminated (#7799)
### Problem 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. ### Solution Add a JVM shutdown hook to write out test results on JVM termination. ### Result JUnit test results are available even when Pants times out on a given test run. ### Notes 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
- Loading branch information
Showing
7 changed files
with
252 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.