-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8288495: [test] Make OutputAnalyzer exception more informative #9247
Conversation
👋 Welcome back rriggs! A progress list of the required criteria for merging this PR into |
@RogerRiggs The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
{ | ||
try { | ||
// Verify the exception message | ||
OutputAnalyzer out = ProcessTools.executeProcess("true"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Roger, this test seems to run on all OS. Is true
available on Windows? If yes, does it require a .exe
suffix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Windows CreateProcess API appends ".exe". (if there is no suffix).
(And CI testing succeeded).
The source changes look fine to me. The test file change would need a copyright year update. |
@@ -502,7 +502,7 @@ public OutputAnalyzer shouldNotHaveExitValue(int notExpectedExitValue) { | |||
if (getExitValue() == notExpectedExitValue) { | |||
reportDiagnosticSummary(); | |||
throw new RuntimeException("Unexpected to get exit value of [" | |||
+ notExpectedExitValue + "]\n"); | |||
+ notExpectedExitValue + "], exit value is: [" + getExitValue() + "]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems redundant to me. "Unexpected to get exit value of [notExpectedExitValue]." should suffice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this doesn't need changing as there is only one value to report.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, a bit overzealous on the expected vs actual.
Correct OutputAnalyzerTest
Please update copyrights in the test file, otherwise, the last version looks good. |
@RogerRiggs This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 109 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the change.
/integrate |
Going to push as commit fdc8455.
Your commit was automatically rebased without conflicts. |
@RogerRiggs Pushed as commit fdc8455. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The RuntimeException from OutputAnalyzer for expected and unexpected exit values should include both the actual and expected values.
The method
shouldHaveExitvalue
andshouldNotHaveExitValue
include the value expected and the value not expected instead of the actual value returned. The values provided in the exception are already known quantities in the code, what is not known is the actual value.The actual value is printed to stderr but not the expected value and in the logs, the exception report is frequently to stdout and therefor separated in the log from the output of stderr. Including both expected and actual values in the exception makes it easier to understand.
Exception messages should not include newlines.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9247/head:pull/9247
$ git checkout pull/9247
Update a local copy of the PR:
$ git checkout pull/9247
$ git pull https://git.openjdk.org/jdk pull/9247/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9247
View PR using the GUI difftool:
$ git pr show -t 9247
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9247.diff