This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Fix toupper/tolower tests for UTF-8 locale
AbandonedPublic

Authored by kparzysz on Oct 19 2016, 6:54 PM.

Details

Reviewers
EricWF
Summary

The characters like '\xDA' or '\xFA' are not valid representations of anything in UTF-8, so toupper and tolower return the character itself in that locale.

Diff Detail

Repository
rL LLVM

Event Timeline

kparzysz updated this revision to Diff 75263.Oct 19 2016, 6:54 PM
kparzysz retitled this revision from to [libcxx] Fix toupper/tolower tests for UTF-8 locale.
kparzysz updated this object.
kparzysz added a reviewer: EricWF.
kparzysz set the repository for this revision to rL LLVM.
kparzysz added a subscriber: cfe-commits.
EricWF edited edge metadata.Oct 19 2016, 8:42 PM

Seems like we should figure out why these pass on ToT OS X.

kparzysz updated this revision to Diff 75292.Oct 20 2016, 6:38 AM
kparzysz edited edge metadata.

Unxfail these tests on Linux.

kparzysz added a comment.EditedOct 20 2016, 6:40 AM

Seems like we should figure out why these pass on ToT OS X.

All of them have

XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
XFAIL: with_system_cxx_lib=x86_64-apple-darwin12

Maybe that's it. I don't have access to OS X, so I can't test it there.

I've tested this patch on OS X and these 4 tests that you've changed now fail.

The XFAIL: with_system_cxx_lib lines don't have any effect on my system - these tests get invoked as expected by lit. Let me know if there's anything else I can do to help you.

I've tested this patch on OS X and these 4 tests that you've changed now fail.

The XFAIL: with_system_cxx_lib lines don't have any effect on my system - these tests get invoked as expected by lit. Let me know if there's anything else I can do to help you.

That's surprising. Seems like something is different on OS X.
Could you try compiling/running this small program?

#include <locale>
#include <iostream>

int main() {
  std::locale x("en_US.UTF-8");
  std::cout << x.name() << std::endl;
}

If it prints "en_US.UTF-8", then I'm out of ideas... :)

And thanks for help. :)

I've tested this patch on OS X and these 4 tests that you've changed now fail.

The XFAIL: with_system_cxx_lib lines don't have any effect on my system - these tests get invoked as expected by lit. Let me know if there's anything else I can do to help you.

That's surprising. Seems like something is different on OS X.
Could you try compiling/running this small program?

#include <locale>
#include <iostream>

int main() {
  std::locale x("en_US.UTF-8");
  std::cout << x.name() << std::endl;
}

If it prints "en_US.UTF-8", then I'm out of ideas... :)

Just tried it, I get "en_US.UTF-8"

I've tested this patch on OS X and these 4 tests that you've changed now fail.

The XFAIL: with_system_cxx_lib lines don't have any effect on my system - these tests get invoked as expected by lit. Let me know if there's anything else I can do to help you.

That's surprising.

"XFAIL: with_system_lib=..." are used for testing against OS X's installed libc++, which is very rarely done. @arphaman is probably testing against the in-tree libc++ on OS X, which is why the XFAIL's have no effect.

Seems like something is different on OS X.

The reason for the different output on Linux and OS X is that they each provide their own different locale data. In particular they provide different toupper/tolower conversion tables. For some reason the ones on OS X seem to support UTF-16 conversions as well. Currently GLIBC doesn't even support UTF-8 multi-byte characters.

While I was attempting to review this patch I ended up coming up with fixed tests myself. I committed them in r290746. I'm very sorry to step on your toes.
However there are plenty more //XFAIL: linux localization tests to fix!

kparzysz abandoned this revision.Jan 3 2017, 1:03 PM

While I was attempting to review this patch I ended up coming up with fixed tests myself. I committed them in r290746. I'm very sorry to step on your toes.

No problem at all. Thanks for the fixes!