Skip to content

ICU-20673 Allow built-in translit ID w/o data. - #958

Merged
FrankYFTang merged 1 commit into
unicode-org:masterfrom
FrankYFTang:ICU-20673
Jan 17, 2020
Merged

FrankYFTang merged 1 commit into
unicode-org:masterfrom
FrankYFTang:ICU-20673

Conversation

@FrankYFTang

@FrankYFTang FrankYFTang commented Jan 3, 2020 •

Copy link
Copy Markdown
Contributor

Ignore errors while reading root.res by using local status.

Checklist

@jira-pull-request-webhook

Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@sffc sffc self-assigned this Jan 8, 2020
@sffc

sffc commented Jan 8, 2020

Copy link
Copy Markdown
Member

LGTM. If we wanted to run this test on CI without data, we could do it by modifying the build command here to only run that one test:

https://github.com/unicode-org/icu/blob/master/.ci-builds/.azure-pipelines.yml#L60

The data filter would be added here:

https://github.com/unicode-org/icu/blob/master/.ci-builds/data-filter.json

Also, please make sure there are tests that cover the two patterns that we identified as problematic:

  • ::NFD; ::[:Nonspacing Mark:] Remove; ::NFC;
  • Lower; NFKD; [:^L:]Remove; NFC;

@FrankYFTang

Copy link
Copy Markdown
Contributor Author

Please take another look. I added unit tests. I am not sure we should run this test on CI without data or not.

@sffc

sffc commented Jan 14, 2020

Copy link
Copy Markdown
Member

LGTM. I pushed a change to the Azure CI builds config file that should run the test in a no-data environment. Adding @jefgen to review the change to the CI file.

@sffc
sffc requested a review from jefgen January 14, 2020 09:55
@sffc

sffc commented Jan 14, 2020

Copy link
Copy Markdown
Member

Looks good:

...
2020-01-14T09:57:24.9077471Z Spawning Python to generate data/rules.mk...
2020-01-14T09:57:25.2317187Z Note: Applying filters from ../../.ci-builds/data-filter.json.
...
(no logs that show building of translit data)
...
2020-01-14T10:02:27.9039422Z === Handling test: translit/TransliteratorTest/TestBasicTransliteratorEvenWithoutData: ===
2020-01-14T10:02:27.9039778Z    translit {
2020-01-14T10:02:27.9040183Z       TransliteratorTest {
2020-01-14T10:02:27.9040523Z          TestBasicTransliteratorEvenWithoutData {
2020-01-14T10:02:27.9066766Z          } OK:   TestBasicTransliteratorEvenWithoutData 
2020-01-14T10:02:27.9067272Z       } OK:   TransliteratorTest 
2020-01-14T10:02:27.9067620Z    } OK:   translit 
2020-01-14T10:02:27.9067966Z 
2020-01-14T10:02:27.9068613Z --------------------------------------
2020-01-14T10:02:27.9069047Z OK: All tests passed without error.
2020-01-14T10:02:27.9069851Z --------------------------------------
2020-01-14T10:02:27.9070284Z Elapsed Time: 00:00:00.004

@sffc sffc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it worth testing that the actual transliterate methods work without error, not just the constructor? I think at least call the transliterate method, and for bonus points, have input/output cases that test that the output is as expected.

Comment thread .ci-builds/data-filter.json Outdated
]
},
// Test mixed feature filter and resource filter
// Exlude translit data so we can run that test

@jefgen jefgen Jan 14, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

minor nit: maybe refer to the ticket number (ICU-20673) instead of just "that" so there's a breadcrumb to follow later on for somebody else? :) #Resolved

const UnicodeString T_PART = UNICODE_STRING_SIMPLE("-t-");

int32_t row, maxRows;
if (U_SUCCESS(status)) {

@jefgen jefgen Jan 14, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if (U_SUCCESS(status)) { [](start = 4, length = 24)

The code before doesn't really do a great job of checking if the data loading above fails due to out-of-memory (OOM) -- but with the changes to use a local status variable now (lstatus) any OOM failure from ures_open or ures_getByKey would be completely hidden entirely.

Would you mind adding a check to see if lstatus is OOM here?

For example, here's a similar example in another file where a localStatus is used:
https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/numsys.cpp#L153

Perhaps something like this:

if (lstatus == U_MEMORY_ALLOCATION_ERROR) {
    delete registry;
    registry = nullptr;
    status = U_MEMORY_ALLOCATION_ERROR;
    return FALSE;
}
``` #Resolved

@jefgen

jefgen commented Jan 14, 2020

Copy link
Copy Markdown
Member

I pushed a change to the Azure CI builds config file that should run the test in a no-data environment. Adding @jefgen Jeff Genovy FTE to review the change to the CI file.

The changes to the CI file LGTM.
Thanks @sffc for adding this!

@FrankYFTang
FrankYFTang requested a review from jefgen January 16, 2020 00:02
jefgen
jefgen previously approved these changes Jan 16, 2020

@jefgen jefgen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Though I didn't thoroughly review all the test cases that you added.
Thanks!

sffc
sffc previously approved these changes Jan 16, 2020

@sffc sffc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, please squash after fixing one nit

Comment thread icu4c/source/test/intltest/transtst.cpp Resolved
FrankYFTang added a commit to FrankYFTang/icu that referenced this pull request Jan 17, 2020
@FrankYFTang
FrankYFTang dismissed stale reviews from sffc and jefgen via 991f877 January 17, 2020 01:44
@jira-pull-request-webhook

Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang
FrankYFTang requested a review from sffc January 17, 2020 01:44
@jira-pull-request-webhook

Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang
FrankYFTang merged commit 21df052 into unicode-org:master Jan 17, 2020
@FrankYFTang
FrankYFTang deleted the ICU-20673 branch February 18, 2020 19:23
@echeran echeran mentioned this pull request Aug 27, 2024
6 of 7 tasks
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