[LLVMdev] libc++ tests: compare.pass test redesign

Oleg Ranevskyy llvm.mail.list at gmail.com
Sun Dec 21 09:43:55 PST 2014


Hello,

I have a problem with one of the libc++ tests and would greatly 
appreciate if you could clarify.

The test is: 
libcxx/test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp.

It sets different locales and compares 2 strings "aaaaaaA" and "BaaaaaA" 
using std::collate::compare. The test expects the comparison result to 
be the same with every locale. This is not right. The result should be 
locale dependent as std::collate_byname uses strcoll_l/wcscoll_l. 
Implementation of these functions in the Apple C lib seems to be bogus, 
which makes the test pass there. Glibc doesn't have this bug, so XFAIL 
was added for linux-gnu.

As an experiment one can create two folders or files named "aaaaaaA" and 
"BaaaaaA" and run the following commands:
    LC_COLLATE=C ls
    LC_COLLATE=en_US.UTF-8 ls
Sort order will be different on Linux but the same on MacOs.

Besides, the test relies on the system locale as well (std::locale 
l("")) and expects a strictly defined comparison result, while the 
result actually depends on the system locale settings and not on the 
test itself.

Probably, the test should be overwritten to pass on Linux and XFAIL on 
platforms with bogus C lib.

Could you please review and share your opinion about this please?

Thank you in advance.
Oleg



More information about the llvm-dev mailing list