-
Notifications
You must be signed in to change notification settings - Fork 6.2k
JDK-8316696: Remove the testing base classes: IntlTest and CollatorTest #15954
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
JDK-8316696: Remove the testing base classes: IntlTest and CollatorTest #15954
Conversation
|
👋 Welcome back jlu! A progress list of the required criteria for merging this PR into |
|
@justin-curtis-lu 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
|
naotoj
left a comment
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.
Great to see this old proprietary test framework removed.
| private int getErrorCount() { | ||
| return errorCount; | ||
| } | ||
|
|
||
| private void err(String message) { | ||
| errorCount++; | ||
| fail(message); | ||
| } | ||
|
|
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.
We could simply eliminate these, by making compareFragmentLists return success indicator.
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 think the previous code was set up so that if forward and backward did not pass, than expected and actual was skipped. Since IntlTest could be ran with -nothrow which allowed for tests to continue even if an error was encountered.
Since that is no longer the case, I simply adjusted compareFragmentLists to fail if an error is found.
| * @build Bug4185732Test HexDumpReader | ||
| * @run junit Bug4185732Test | ||
| * @summary test that ChoiceFormat invariants are preserved across serialization | ||
| * Run prepTest() if the invariant files are not yet generated. |
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 presume those invariant files are already in the test directory. I would simply remove this prepTest() altogether (also seen in other tests).
| public static void main(String[] args) throws Exception { | ||
| if (args.length > 0 && args[0].equals("-debug")) { | ||
| DEBUG = true; | ||
| String[] newargs = new String[args.length - 1]; | ||
| System.arraycopy(args, 1, newargs, 0, newargs.length); | ||
| args = newargs; | ||
| } | ||
| new NumberRoundTrip().run(args); | ||
| } | ||
|
|
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.
Probably we could eliminate DEBUG, and always print the information.
| // The current tests are only appropriate for US. If tests are | ||
| // added for other locales are added, then a property should be | ||
| // added to each file (test) to be able to specify the locale. |
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.
Probably this comment needs to be preserved.
| * Collator related tests can use. | ||
| */ | ||
| public abstract class CollatorTest extends IntlTest { | ||
| public final class CollatorTestUtils { |
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.
Can the utilities in this class be merged into TestUtils?
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.
Merged CollatorTestUtils into TestUtils. I adjusted some method names which were previously in CollatorTestUtils to make more sense, now that they are in TestUtils.
| if (inDaylight != lastDST) | ||
| { | ||
| logln("Switch " + (inDaylight ? "into" : "out of") | ||
| System.out.println("Switch " + (inDaylight ? "into" : "out of") |
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'd remove this commented-out code entirely.
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.
Removed this and the other occurrence you spotted.
| System.out.println("========================================"); | ||
| System.out.println("Stepping using millis"); |
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 too
| fail("Locale didn't maintain invariants for: "+lang); | ||
| fail(" got: "+loc); | ||
| fail(" excpeted: "+expected); |
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 will only log the message in the first fail() invocation. This may be auto-converted by the script, so you might want to check other places.
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.
Good point, adjusted all locations of this to be contained in one fail() call.
naotoj
left a comment
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 changes
|
@justin-curtis-lu 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 32 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 |
|
/integrate |
|
Going to push as commit b859da9.
Your commit was automatically rebased without conflicts. |
|
@justin-curtis-lu Pushed as commit b859da9. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review this PR which removes the i18n related testing base classes
IntlTestandCollatorTestand converts all the tests that use them,IntlTest and CollatorTest are testing classes which are extended by tests in
text/,util/Locale,util/TimeZone, andutil/Calendar. The abstract testing classes are quite dated and have caused issues such as: variation between OS, hiding stack trace, and causing tests to spuriously pass.This change mainly automates a low level conversion of all the tests (75) using the frameworks; all tests were converted to use JUnit instead. (With the exception of
DateFormatRoundTripTestdue to the nature of the test).The main changes can be viewed in the following commits
scripted changes - c0ece01
manual changes - 9a54910
removal of IntlTest and CollatorTest - 8ee9f9c f90266f 3c67679
Tiers 1-3 clean
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15954/head:pull/15954$ git checkout pull/15954Update a local copy of the PR:
$ git checkout pull/15954$ git pull https://git.openjdk.org/jdk.git pull/15954/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15954View PR using the GUI difftool:
$ git pr show -t 15954Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15954.diff
Webrev
Link to Webrev Comment