Skip to content

ICU-20991 Trace BreakIterator/BreakEngine creation - #1014

Merged
FrankYFTang merged 1 commit into
unicode-org:masterfrom
FrankYFTang:utrace
Mar 6, 2020
Merged

FrankYFTang merged 1 commit into
unicode-org:masterfrom
FrankYFTang:utrace

Conversation

@FrankYFTang

Copy link
Copy Markdown
Contributor

Extend utrace enum to trace BreakIterator instance and internal language break engine

Checklist

@jira-pull-request-webhook

Copy link
Copy Markdown

Notice: the branch changed across the force-push!

  • icu4c/source/test/intltest/rbbitst.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@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.

Looks pretty good! Just one comment and a question

Comment thread icu4c/source/test/intltest/rbbitst.cpp Resolved
Comment thread icu4c/source/test/intltest/rbbitst.cpp Resolved
@jefgen

jefgen commented Mar 6, 2020

Copy link
Copy Markdown
Member

FYI: The clang asan Travis build is apparently hitting a heap-buffer-overflow failure with the changes somehow...

=================================================================
==21817== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603001856028 at pc 0x7f8b4e904008 bp 0x7fffd506c9e0 sp 0x7fffd506c9d8
READ of size 4 at 0x603001856028 thread T0
    #0 0x7f8b4e904007 in icu::TimeZoneNamesDelegate::~TimeZoneNamesDelegate() /home/travis/build/unicode-org/icu/icu4c/source/i18n/tznames.cpp:214:13
    #1 0x7f8b4e904138 in icu::TimeZoneNamesDelegate::~TimeZoneNamesDelegate() /home/travis/build/unicode-org/icu/icu4c/source/i18n/tznames.cpp:210:49
    #2 0x7f8b4e930157 in icu::TimeZoneFormat::~TimeZoneFormat() /home/travis/build/unicode-org/icu/icu4c/source/i18n/tzfmt.cpp:433:5
    #3 0x7f8b4e930468 in icu::TimeZoneFormat::~TimeZoneFormat() /home/travis/build/unicode-org/icu/icu4c/source/i18n/tzfmt.cpp:432:35
    #4 0x7f8b4e4c1327 in icu::SimpleDateFormat::~SimpleDateFormat() /home/travis/build/unicode-org/icu/icu4c/source/i18n/smpdtfmt.cpp:326:9
    #5 0x7f8b4e4c17f8 in icu::SimpleDateFormat::~SimpleDateFormat() /home/travis/build/unicode-org/icu/icu4c/source/i18n/smpdtfmt.cpp:320:1
    #6 0x66a358 in CalendarTimeZoneTest::cleanup() /home/travis/build/unicode-org/icu/icu4c/source/test/intltest/caltztst.cpp:238:5
    #7 0x825843 in main /home/travis/build/unicode-org/icu/icu4c/source/test/intltest/intltest.cpp:1529:5
    #8 0x7f8b4a74b82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #9 0x492348 in _start (/home/travis/build/unicode-org/icu/icu4c/source/test/intltest/intltest+0x492348)

@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.

Looks like removing the u_cleanup fixed the tests.

Comment thread icu4c/source/test/intltest/rbbitst.cpp Outdated

assertEquals("utrace_entry should be called ", UTRACE_UBRK_CREATE_WORD, gEntryFn[0]);
assertEquals("utrace_exit should be called ", UTRACE_UBRK_CREATE_WORD, gExitFn[0]);
stringStream << "utrace_entry got called " << gEntryFn.size() << " times\n"

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.

When someone in the future tries to read this test, it won't be clear what was the expected result. They'll get a bunch of output, but it's not clear what the output was supposed to be.

Suggestion: How about making a little function assertEqualsOptional that uses logln instead of errln when the arguments don't match? Then your code is still readable. You could put the function either here or in intltest.cpp.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It will be confusing to setup expectation without calling a clean up in front. I now hook up to the rbbi clean up only from test and see will that help.

Comment thread icu4c/source/test/intltest/rbbitst.cpp Resolved
@jefgen

jefgen commented Mar 6, 2020

Copy link
Copy Markdown
Member

Looks like removing the u_cleanup fixed the tests.

Indeed, I suspect a test was likely holding a pointer to something that got cleaned-up.

Thanks!

@sffc

sffc commented Mar 6, 2020

Copy link
Copy Markdown
Member

LGTM; wait for the tests to come back, then please squash. (I requested a re-build of AppVeyor)

@FrankYFTang

Copy link
Copy Markdown
Contributor Author

PTAL calling rbbi_cleanup() instead of u_cleanup() does address the heap-buffer-overflow failure issue.

@sffc

sffc commented Mar 6, 2020

Copy link
Copy Markdown
Member

LGTM please squash. The AppVeyor failure looks like a flake.

@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 94c9ff2 into unicode-org:master Mar 6, 2020
@FrankYFTang
FrankYFTang deleted the utrace branch March 16, 2020 18:59
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