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

CLDR-16393 assume cldr-archive is present for tests #3215

Merged
merged 10 commits into from
Nov 30, 2023

Conversation

srl295
Copy link
Member

@srl295 srl295 commented Aug 23, 2023

  • UNLESS -DNO_CLDR_ARCHIVE=true is set

CLDR-16393

  • This PR completes the ticket.

This will cause tests to FAIL unless:

  • cldr-archive is setup OR
  • -DNO_CLDR_ARCHIVE=true is set.

ALLOW_MANY_COMMITS=true

⚠️ if we merge this, users will start getting failures unless they have an up-to-date cldr-archive OR disable the check as described here.

@srl295 srl295 requested review from macchiati and btangmu August 23, 2023 18:14
@srl295 srl295 self-assigned this Aug 23, 2023
btangmu
btangmu previously approved these changes Aug 23, 2023
macchiati
macchiati previously approved these changes Aug 23, 2023
@srl295 srl295 dismissed stale reviews from macchiati and btangmu via 4203997 August 23, 2023 23:43
@srl295 srl295 force-pushed the cldr-16393/ci-cldr-archive branch from 0b2d39b to 4203997 Compare August 23, 2023 23:43
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • tools/cldr-code/src/test/java/org/unicode/cldr/util/TestCLDRPaths.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@srl295 srl295 marked this pull request as ready for review August 23, 2023 23:50
@srl295
Copy link
Member Author

srl295 commented Aug 24, 2023

old tests fail though,

Error:  (TestBasic.java:1454)  Error: : ldml DTD - Trunk children of «zone» must be superset of v1.5.1, and must contain «usesMetazone»: expected != null

Error:  (TestBasic.java:1454)  Error: : ldml DTD - Trunk children of «zone» must be superset of v1.5.0.1, and must contain «usesMetazone»: expected != null

Error:  (TestBasic.java:1454)  Error: : ldmlICU DTD - Trunk children of «zone» must be superset of v1.5.1, and must contain «usesMetazone»: expected != null

Error:  (TestBasic.java:1454)  Error: : ldmlICU DTD - Trunk children of «zone» must be superset of v1.5.0.1, and must contain «usesMetazone»: expected != null

maybe a new logknown issue to skip the failing ones?

@srl295
Copy link
Member Author

srl295 commented Aug 26, 2023

old tests fail though,

Error:  (TestBasic.java:1454)  Error: : ldml DTD - Trunk children of «zone» must be superset of v1.5.1, and must contain «usesMetazone»: expected != null

Error:  (TestBasic.java:1454)  Error: : ldml DTD - Trunk children of «zone» must be superset of v1.5.0.1, and must contain «usesMetazone»: expected != null

Error:  (TestBasic.java:1454)  Error: : ldmlICU DTD - Trunk children of «zone» must be superset of v1.5.1, and must contain «usesMetazone»: expected != null

Error:  (TestBasic.java:1454)  Error: : ldmlICU DTD - Trunk children of «zone» must be superset of v1.5.0.1, and must contain «usesMetazone»: expected != null

maybe a new logknown issue to skip the failing ones?

I'll probably do this, but later

@srl295 srl295 force-pushed the cldr-16393/ci-cldr-archive branch from bbacbcc to 0b683a6 Compare August 30, 2023 22:52
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckHtmlFiles.java is now changed in the branch
  • tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDtd.java is now changed in the branch
  • tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateItemCounts.java is now changed in the branch
  • tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateReformattedXml.java is now changed in the branch
  • tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowStarredCoverage.java is now changed in the branch
  • tools/cldr-code/src/main/java/org/unicode/cldr/util/DtdType.java is different
  • tools/cldr-code/src/main/java/org/unicode/cldr/util/SupplementalDataInfo.java is different
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java is different
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestComparisonBuilder.java is now changed in the branch
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDTDAttributes.java is now changed in the branch
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDtdData.java is now changed in the branch
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java is now changed in the branch
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPaths.java is now changed in the branch
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestValidity.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@macchiati
Copy link
Member

Looks like roughly the right direction, but we are running short of time; I will check in later quickly, but basically I'm done through the 6th and you through the 15th.

We will need to regenerate charts and do other things that depend on platforms (which are far more timely than Subdivisiions) so I suggest again that you restore platforms with a dummy file so that we can proceed.

@srl295
Copy link
Member Author

srl295 commented Aug 30, 2023

Looks like roughly the right direction, but we are running short of time; I will check in later quickly, but basically I'm done through the 6th and you through the 15th.

We will need to regenerate charts and do other things that depend on platforms (which are far more timely than Subdivisiions) so I suggest again that you restore platforms with a dummy file so that we can proceed.

There are other bugs in the unit tests besides platforms. It's not respecting the firstVersion parameter.

This PR currently knows about but skips DtdType.platform in all loops, is that sufficient ?what process "needs" platforms?

@macchiati
Copy link
Member

No process uses it; most of the attributeValidity is no longer used.
I'm just leery of such a big change at a bad time.

@srl295
Copy link
Member Author

srl295 commented Aug 31, 2023

No process uses it; most of the attributeValidity is no longer used.

I'm just leery of such a big change at a bad time.

Mark, I hear you; but there are other major breakages in the tests. FirstVersion is ignored in many cases. ElementInfo also ignores firstVersion.

Can you comment on the unit comparator "jp-bu" I think it was ?

@macchiati
Copy link
Member

macchiati commented Aug 31, 2023 via email

@macchiati
Copy link
Member

macchiati commented Aug 31, 2023 via email

@srl295
Copy link
Member Author

srl295 commented Aug 31, 2023

image

@macchiati this is the next issue hit, in the code that GenerateSubdivisions (and others) will hit, that the bu-jp units aren't present prior to v44.

@srl295
Copy link
Member Author

srl295 commented Aug 31, 2023

Can you comment on the unit comparator "jp-bu" I think it was ?
I don't have enough context to know what you mean by this. There is a unit comparator, and there is a bu-jp unit that it will compare (below), but I don't know what the problem is.

the bu-jp units aren't present in units.xml prior to v44, that seems to be the source of the failure.

I'm fine to table this for now if it's off the critical path.

@macchiati
Copy link
Member

Lot's of units come into new versions, so it must be something special about that one.

@srl295
Copy link
Member Author

srl295 commented Aug 31, 2023

But do you agree to put this on ice for the moment?

@macchiati
Copy link
Member

macchiati commented Aug 31, 2023 via email

- UNLESS -DNO_CLDR_ARCHIVE=true is set
- also, reinstate the 'platform' DtdType as 'removed'
- skip ldmlICU versions that are missing
- ElementAttributeInfo needs to skip XML files that are missing
@srl295 srl295 force-pushed the cldr-16393/ci-cldr-archive branch from 1fd4f05 to 4bd5711 Compare November 29, 2023 20:57
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • tools/cldr-code/src/main/java/org/unicode/cldr/tool/CldrVersion.java is different
  • tools/cldr-code/src/main/java/org/unicode/cldr/util/DtdType.java is different
  • tools/cldr-code/src/main/java/org/unicode/cldr/util/ElementAttributeInfo.java is different
  • tools/cldr-code/src/main/java/org/unicode/cldr/util/SupplementalDataInfo.java is different
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java is different
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestComparisonBuilder.java is different
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDtdData.java is different
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java is different
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPaths.java is different
  • tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestTransforms.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@srl295
Copy link
Member Author

srl295 commented Nov 29, 2023

just rebasing this PR in my queue.

@srl295
Copy link
Member Author

srl295 commented Nov 29, 2023

this was affected by CLDR-17078 rename ldmlKeyboard.dtd to ldmlKeyboard3.dtd #3274 because we are retaining the old DTDs. It doesn't attempt to have new code test the old DTDs.

@srl295
Copy link
Member Author

srl295 commented Nov 29, 2023

@macchiati when this merges, you will be able to create new tests that use cldr-archive with the following snippet. No need to warn or anything as warning is already handled globally.

        if (!TestCLDRPaths.canUseArchiveDirectory()) {
            return; // skipped
        }

        // ... use cldr-archive ...

JUnit tests can use:

        assumeTrue(TestCLDRPaths.canUseArchiveDirectory());

… which will show the entire test as skipped, providing a better flag to the user.

@srl295 srl295 requested review from btangmu and macchiati November 29, 2023 21:04
@srl295
Copy link
Member Author

srl295 commented Nov 29, 2023

Can you comment on the unit comparator "jp-bu" I think it was ?
I don't have enough context to know what you mean by this. There is a unit comparator, and there is a bu-jp unit that it will compare (below), but I don't know what the problem is.

this issue didn't surface with current code/data.

Copy link
Member

@macchiati macchiati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Just a few tweaks needed.

@@ -21,6 +21,7 @@ public static void main(String[] args) throws IOException {
final DTD2Markdown dtd2md = new DTD2Markdown();
// System.setProperty("show_all", "true");
for (DtdType type : DtdType.values()) {
if (type.getStatus() != DtdType.DtdStatus.active) continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing {...}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens multiple times below, so check for those also.

String.format(
"Could not read archive directory %s. "
+ "Please: "
+ "1) setup the archive, <https://cldr.unicode.org/development/creating-the-archive>, "
Copy link
Member

@macchiati macchiati Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ambiguous: does this mean #1 and (#2 or #3), or (#1 and #2) or #3?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've changed this (see example run below).

I took out the option of changing -DARCHIVE by instead folding that into the informative. message (-DARCHIVE=/a/b/c) - so if /a/b/c is the wrong path the user can correct that property.

Will need to update the docs page after this of course.

@macchiati
Copy link
Member

macchiati commented Nov 29, 2023 via email

@srl295
Copy link
Member Author

srl295 commented Nov 30, 2023

false-by-default means that omitting any property (such as HAS_CLDR_ARCHIVE) means it has a false value, that's how other settings work. But i can make this one true by default.

@srl295
Copy link
Member Author

srl295 commented Nov 30, 2023

Example test run with default arguments (assumes -DHAS_CLDR_ARCHIVE=true)

[INFO] Running org.unicode.cldr.util.TestCLDRPaths
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.036 s - in org.unicode.cldr.util.TestCLDRPaths

Example test run with -DHAS_CLDR_ARCHIVE=false

[INFO] Running org.unicode.cldr.util.TestCLDRPaths
WARNING: -DHAS_CLDR_ARCHIVE=false, so skipping tests which use cldr-archive
See <https://cldr.unicode.org/development/creating-the-archive>
[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.303 s - in org.unicode.cldr.util.TestCLDRPaths

Example test run where cldr-archive isn't setup properly:

[ERROR] org.unicode.cldr.util.TestCLDRPaths.TestCanUseArchiveDirectory  Time elapsed: 0.002 s  <<< ERROR!
java.lang.IllegalArgumentException: Could not read archive directory -DARCHIVE=/Users/srl295/src/cldr-archive
You must either:
 1) follow instructions at <https://cldr.unicode.org/development/creating-the-archive>, or
 2) skip cldr-archive tests by setting -DHAS_CLDR_ARCHIVE=false

@@ -197,6 +197,7 @@ private static void checkBadAttributes(Relation<String, String> path2value2, Str

SupplementalDataInfo supp = SUPPLEMENTAL_DATA_INFO;
for (DtdType dtdType : DtdType.values()) {
if (dtdType.getStatus() != DtdType.DtdStatus.active) continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's an Eclipse tool that will add {...} after every if statement. If you want to fix these (and others) that way, a separate PR would work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since were using spotless it would be better to set spotless to do this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@macchiati there are 2,000+ cases of single-line if statements in the code. I couldn't find a spotless setting to fix this, though eclipse has one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@macchiati @srl295 here is a PR with comments implying that Google Java Style does call for doing what Mark wants here, however google-java-format has a "constraint of only modifying whitespace": google/google-java-format#938

The implication seems to be that if we inserted brackets as a one-time operation using a different tool, then spotless configured for google-java-format would preserve the brackets, but exceptions could still arise in new code

@srl295 srl295 merged commit 974b361 into unicode-org:main Nov 30, 2023
10 checks passed
@srl295 srl295 deleted the cldr-16393/ci-cldr-archive branch November 30, 2023 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants