This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix get/put long_double_ru_RU on Glibc, FreeBSD and Windows
ClosedPublic

Authored by mstorsjo on Feb 22 2022, 4:04 AM.

Details

Summary

Note, reducing ios.width() in put_long_double instead of using variable
padding, when using a variable width symbol. Some of those tests didn't
actually trigger any padding in the existing form, with a longer
currency symbol; reduce the width so there's no actual padding with the
slightly shorter currency symbol either.

The tests for the international currency symbol use the same amount of
padding on all platforms, so they still exercise the padding properly.

Diff Detail

Event Timeline

mstorsjo created this revision.Feb 22 2022, 4:04 AM
mstorsjo requested review of this revision.Feb 22 2022, 4:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2022, 4:04 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante added inline comments.Feb 23 2022, 9:39 AM
libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
54

Would it make sense to move this function to a helper header and share the code between the two tests?

57

Please reduce the scope to the loop.
Please use a lower case i.

62

std::iswdigit requires <cwctype>.

mstorsjo added inline comments.Feb 23 2022, 9:44 AM
libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
54

I guess that could be done - we have the same in the get/put long_double fr_FR tests too (but with slightly different constellation of separators across systems). Do you have a suggestion on where to place it?

57

Ok, can do. This is based on copypaste from the existing fr_FR tests though. But if we move the helper out somewhere, we could do the same cleanup at the same time.

62

Thanks, good catch!

mstorsjo updated this revision to Diff 411228.Feb 24 2022, 1:52 PM

Sharing the convert_thousands_sep helper function in a new header, locale_helpers.h, across {get,put}_long_double_{fr_FR,ru_RU} tests.

mstorsjo updated this revision to Diff 411327.Feb 24 2022, 11:15 PM

Trying to fix failures in the no-wchar configuration.

Mordante accepted this revision as: Mordante.Feb 28 2022, 10:43 AM

LGTM!

libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
54

I would suggest under test/support, but I see you already did that.

Quuxplusone requested changes to this revision.Mar 1 2022, 8:37 AM

No strong objection to it as-is, but I think there are improvements possible.

libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
74

Consider whether this can be simply

std::string symbol = "\u20BD";
~~~
std::string symbol = "\u0440\u0443\u0431.";
408–410

As above, can this use \u instead of \x?

libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
73–75

As above. I'm also starting to wonder if you now have a convenient place to hang LocaleHelpers::russian_currency_symbol(). :)
(Or currency_symbol_ru_RU() or whatever naming convention you like.)

This revision now requires changes to proceed.Mar 1 2022, 8:37 AM
mstorsjo updated this revision to Diff 412234.Mar 1 2022, 1:41 PM

Factorize the platform differences for the currency symbol from the curr_symbol test into LocaleHelpers, use unicode code points instead of individual utf8 bytes in the strings.

Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 1:41 PM
mstorsjo updated this revision to Diff 412333.Mar 2 2022, 12:26 AM

Fixed the no-wide-chars configuration.

Quuxplusone requested changes to this revision.Mar 2 2022, 1:01 PM

Let's do one more round, just to see if MultiStringType is useful.

libcxx/test/support/locale_helpers.h
74

I wonder if you could use MultiStringType instead of std::string here, and then you wouldn't need to repeat yourself on lines 90-108.

76–82

The comments are just repeating what the code says.
(The only reason I don't also comment on the "\u0440\u0443\u0431" line is that I can't think of a short yet enlightening comment to put, except for // "руб", and I don't want to encourage non-ASCII comments.)

This revision now requires changes to proceed.Mar 2 2022, 1:01 PM
mstorsjo updated this revision to Diff 412526.Mar 2 2022, 1:22 PM

Factorize currency_symbol_ru_RU() to use MultiStringType, applied the suggested cleanups (removing redundant comments, adding unicode char explanations).

Quuxplusone accepted this revision.Mar 2 2022, 2:59 PM

LGTM % one last comment! I think MultiStringType really cleaned it up nicely.

libcxx/test/support/locale_helpers.h
49–55

I think this will be easier to grok. (It follows the same pattern as lines 76-83 below.)

This revision is now accepted and ready to land.Mar 2 2022, 2:59 PM
mstorsjo updated this revision to Diff 412631.Mar 3 2022, 1:25 AM

Fix the use of MultiString in the curr_symbol testcase.

Hello,

I see the following failures with this commit:

FAIL: libc++ :: std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp (466 of 7808)
******************** TEST 'libc++ :: std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp' FAILED ********************
Script:
--
: 'COMPILED WITH';  /repo/uabelho/master-github/llvm/build-all-builtins/./bin/clang++ /repo/uabelho/master-github/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp -v --target=x86_64-unknown-linux-gnu -nostdinc++ -isystem /repo/uabelho/master-github/llvm/build-all-builtins/include/x86_64-unknown-linux-gnu/c++/v1 -isystem /repo/uabelho/master-github/llvm/build-all-builtins/include/c++/v1 -I/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/repo/uabelho/master-github/libcxx/test/support -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER  -lc++experimental -L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -nodefaultlibs -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic -o /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/Output/get_long_double_ru_RU.pass.cpp.dir/t.tmp.exe
: 'EXECUTED AS';  "/app/vbuild/RHEL7-x86_64/python/3.8.0/bin/python3.8" /repo/uabelho/master-github/libcxx/test/../utils/run.py --execdir /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/Output/get_long_double_ru_RU.pass.cpp.dir --codesign_identity "" --env  --  /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/Output/get_long_double_ru_RU.pass.cpp.dir/t.tmp.exe
--
Exit Code: 250

Command Output (stdout):
--
$ ":" "COMPILED WITH"
note: command had no output on stdout or stderr
$ "/repo/uabelho/master-github/llvm/build-all-builtins/./bin/clang++" "/repo/uabelho/master-github/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp" "-v" "--target=x86_64-unknown-linux-gnu" "-nostdinc++" "-isystem" "/repo/uabelho/master-github/llvm/build-all-builtins/include/x86_64-unknown-linux-gnu/c++/v1" "-isystem" "/repo/uabelho/master-github/llvm/build-all-builtins/include/c++/v1" "-I/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/include/c++build" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-I/repo/uabelho/master-github/libcxx/test/support" "-std=c++2b" "-Werror" "-Wall" "-Wextra" "-Wshadow" "-Wundef" "-Wno-unused-command-line-argument" "-Wno-attributes" "-Wno-pessimizing-move" "-Wno-c++11-extensions" "-Wno-user-defined-literals" "-Wno-noexcept-type" "-Wno-atomic-alignment" "-Wsign-compare" "-Wunused-variable" "-Wunused-parameter" "-Wunreachable-code" "-Wno-unused-local-typedef" "-D_LIBCPP_DISABLE_AVAILABILITY" "-fcoroutines-ts" "-Werror=thread-safety" "-Wuser-defined-warnings" "-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER" "-lc++experimental" "-L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu" "-Wl,-rpath,/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu" "-L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu" "-Wl,-rpath,/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu" "-nodefaultlibs" "-lc++" "-lm" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" "-lgcc" "-latomic" "-o" "/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/Output/get_long_double_ru_RU.pass.cpp.dir/t.tmp.exe"
# command stderr:
clang version 15.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /repo/uabelho/master-github/llvm/build-all-builtins/./bin
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/repo/uabelho/master-github/llvm/build-all-builtins/bin/clang-15" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -main-file-name get_long_double_ru_RU.pass.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members -nostdinc++ -resource-dir /repo/uabelho/master-github/llvm/build-all-builtins/lib/clang/15.0.0 -isystem /repo/uabelho/master-github/llvm/build-all-builtins/include/x86_64-unknown-linux-gnu/c++/v1 -isystem /repo/uabelho/master-github/llvm/build-all-builtins/include/c++/v1 -I /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /repo/uabelho/master-github/libcxx/test/support -D _LIBCPP_DISABLE_AVAILABILITY -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /repo/uabelho/master-github/llvm/build-all-builtins/lib/clang/15.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Werror=thread-safety -Wuser-defined-warnings -std=c++2b -fdeprecated-macro -fdebug-compilation-dir=/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members -ferror-limit 19 -fcoroutines-ts -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/lit-tmp-h6axl3wy/get_long_double_ru_RU-0c1264.o -x c++ /repo/uabelho/master-github/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
clang -cc1 version 15.0.0 based upon LLVM 15.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../x86_64-redhat-linux/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/include/c++build
 /repo/uabelho/master-github/libcxx/test/support
 /repo/uabelho/master-github/llvm/build-all-builtins/include/x86_64-unknown-linux-gnu/c++/v1
 /repo/uabelho/master-github/llvm/build-all-builtins/include/c++/v1
 /repo/uabelho/master-github/llvm/build-all-builtins/lib/clang/15.0.0/include
 /usr/local/include
 /usr/include
End of search list.
 "/proj/flexasic/app/llvm/8.0/bin/ld" --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/Output/get_long_double_ru_RU.pass.cpp.dir/t.tmp.exe /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -L/repo/uabelho/master-github/llvm/build-all-builtins/bin/../lib/x86_64-unknown-linux-gnu -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/repo/uabelho/master-github/llvm/build-all-builtins/bin/../lib -L/lib -L/usr/lib /tmp/lit-tmp-h6axl3wy/get_long_double_ru_RU-0c1264.o -lc++experimental -rpath /repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -rpath /repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o

$ ":" "EXECUTED AS"
note: command had no output on stdout or stderr
$ "/app/vbuild/RHEL7-x86_64/python/3.8.0/bin/python3.8" "/repo/uabelho/master-github/libcxx/test/../utils/run.py" "--execdir" "/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/Output/get_long_double_ru_RU.pass.cpp.dir" "--codesign_identity" "" "--env" "--" "/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/Output/get_long_double_ru_RU.pass.cpp.dir/t.tmp.exe"
# command stderr:
t.tmp.exe: /repo/uabelho/master-github/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp:82: int main(int, char **): Assertion `iter.base() == v.data() + v.size()' failed.

error: command failed with exit status: 250

--

********************
FAIL: libc++ :: std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp (855 of 7808)
******************** TEST 'libc++ :: std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp' FAILED ********************
Script:
--
: 'COMPILED WITH';  /repo/uabelho/master-github/llvm/build-all-builtins/./bin/clang++ /repo/uabelho/master-github/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp -v --target=x86_64-unknown-linux-gnu -nostdinc++ -isystem /repo/uabelho/master-github/llvm/build-all-builtins/include/x86_64-unknown-linux-gnu/c++/v1 -isystem /repo/uabelho/master-github/llvm/build-all-builtins/include/c++/v1 -I/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/repo/uabelho/master-github/libcxx/test/support -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER  -lc++experimental -L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -nodefaultlibs -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic -o /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/Output/put_long_double_ru_RU.pass.cpp.dir/t.tmp.exe
: 'EXECUTED AS';  "/app/vbuild/RHEL7-x86_64/python/3.8.0/bin/python3.8" /repo/uabelho/master-github/libcxx/test/../utils/run.py --execdir /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/Output/put_long_double_ru_RU.pass.cpp.dir --codesign_identity "" --env  --  /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/Output/put_long_double_ru_RU.pass.cpp.dir/t.tmp.exe
--
Exit Code: 250

Command Output (stdout):
--
$ ":" "COMPILED WITH"
note: command had no output on stdout or stderr
$ "/repo/uabelho/master-github/llvm/build-all-builtins/./bin/clang++" "/repo/uabelho/master-github/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp" "-v" "--target=x86_64-unknown-linux-gnu" "-nostdinc++" "-isystem" "/repo/uabelho/master-github/llvm/build-all-builtins/include/x86_64-unknown-linux-gnu/c++/v1" "-isystem" "/repo/uabelho/master-github/llvm/build-all-builtins/include/c++/v1" "-I/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/include/c++build" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-I/repo/uabelho/master-github/libcxx/test/support" "-std=c++2b" "-Werror" "-Wall" "-Wextra" "-Wshadow" "-Wundef" "-Wno-unused-command-line-argument" "-Wno-attributes" "-Wno-pessimizing-move" "-Wno-c++11-extensions" "-Wno-user-defined-literals" "-Wno-noexcept-type" "-Wno-atomic-alignment" "-Wsign-compare" "-Wunused-variable" "-Wunused-parameter" "-Wunreachable-code" "-Wno-unused-local-typedef" "-D_LIBCPP_DISABLE_AVAILABILITY" "-fcoroutines-ts" "-Werror=thread-safety" "-Wuser-defined-warnings" "-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER" "-lc++experimental" "-L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu" "-Wl,-rpath,/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu" "-L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu" "-Wl,-rpath,/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu" "-nodefaultlibs" "-lc++" "-lm" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" "-lgcc" "-latomic" "-o" "/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/Output/put_long_double_ru_RU.pass.cpp.dir/t.tmp.exe"
# command stderr:
clang version 15.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /repo/uabelho/master-github/llvm/build-all-builtins/./bin
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/repo/uabelho/master-github/llvm/build-all-builtins/bin/clang-15" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -main-file-name put_long_double_ru_RU.pass.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members -nostdinc++ -resource-dir /repo/uabelho/master-github/llvm/build-all-builtins/lib/clang/15.0.0 -isystem /repo/uabelho/master-github/llvm/build-all-builtins/include/x86_64-unknown-linux-gnu/c++/v1 -isystem /repo/uabelho/master-github/llvm/build-all-builtins/include/c++/v1 -I /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /repo/uabelho/master-github/libcxx/test/support -D _LIBCPP_DISABLE_AVAILABILITY -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /repo/uabelho/master-github/llvm/build-all-builtins/lib/clang/15.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Werror=thread-safety -Wuser-defined-warnings -std=c++2b -fdeprecated-macro -fdebug-compilation-dir=/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members -ferror-limit 19 -fcoroutines-ts -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/lit-tmp-h6axl3wy/put_long_double_ru_RU-609d1c.o -x c++ /repo/uabelho/master-github/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
clang -cc1 version 15.0.0 based upon LLVM 15.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../x86_64-redhat-linux/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/include/c++build
 /repo/uabelho/master-github/libcxx/test/support
 /repo/uabelho/master-github/llvm/build-all-builtins/include/x86_64-unknown-linux-gnu/c++/v1
 /repo/uabelho/master-github/llvm/build-all-builtins/include/c++/v1
 /repo/uabelho/master-github/llvm/build-all-builtins/lib/clang/15.0.0/include
 /usr/local/include
 /usr/include
End of search list.
 "/proj/flexasic/app/llvm/8.0/bin/ld" --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/Output/put_long_double_ru_RU.pass.cpp.dir/t.tmp.exe /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -L/repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -L/repo/uabelho/master-github/llvm/build-all-builtins/bin/../lib/x86_64-unknown-linux-gnu -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/repo/uabelho/master-github/llvm/build-all-builtins/bin/../lib -L/lib -L/usr/lib /tmp/lit-tmp-h6axl3wy/put_long_double_ru_RU-609d1c.o -lc++experimental -rpath /repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -rpath /repo/uabelho/master-github/llvm/build-all-builtins/./lib/x86_64-unknown-linux-gnu -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o

$ ":" "EXECUTED AS"
note: command had no output on stdout or stderr
$ "/app/vbuild/RHEL7-x86_64/python/3.8.0/bin/python3.8" "/repo/uabelho/master-github/libcxx/test/../utils/run.py" "--execdir" "/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/Output/put_long_double_ru_RU.pass.cpp.dir" "--codesign_identity" "" "--env" "--" "/repo/uabelho/master-github/llvm/build-all-builtins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/Output/put_long_double_ru_RU.pass.cpp.dir/t.tmp.exe"
# command stderr:
t.tmp.exe: /repo/uabelho/master-github/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp:80: int main(int, char **): Assertion `ex == "0,00"' failed.

error: command failed with exit status: 250

--

********************
********************
Failed Tests (2):
  libc++ :: std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
  libc++ :: std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp

Any idea?

Hello,

I see the following failures with this commit:

Any idea?

Sorry about that. It would seem like there are differences in the ru_RU.UTF-8 locale in your installation than in the ones used in CI and in my local environment. What glibc version are you running (as it would seem we require to selectively expect different results on different versions of glibc)?

Can you rerun the put_long_double_ru_RU.pass.cpp test with this diff applied?

diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
index ae5071907aca..a7156e78132e 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
@@ -77,6 +77,9 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
         std::string ex(str, base(iter));
+        for (char c : ex)
+            fprintf(stderr, "%02x ", c);
+        fprintf(stderr, "\n");                 
         assert(ex == "0,00");
     }      
     {   // negative one

Alternatively, even better, can you provide the output of this test program:

#include <locale.h>
#include <stdio.h>

int main(int argc, char **argv) {
    const char *locale = "ru_RU.UTF-8";
    if (argc > 1)
        locale = argv[1];
    if (!setlocale(LC_ALL, locale)) {
        printf("setlocale(%s) failed\n", locale);
        return 1;
    }
    struct lconv *lconv = localeconv();
    printf("mon_thousands_sep: \"%s\",", lconv->mon_thousands_sep);
    for (const char *c = lconv->mon_thousands_sep; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("thousands_sep: \"%s\",", lconv->thousands_sep);
    for (const char *c = lconv->thousands_sep; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("int_curr_symbol: \"%s\"\n", lconv->int_curr_symbol);
    printf("currency_symbol: \"%s\",", lconv->currency_symbol);
    for (const char *c = lconv->currency_symbol; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("decimal_point: \"%s\",", lconv->decimal_point);
    for (const char *c = lconv->decimal_point; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("mon_decimal_point: \"%s\",", lconv->mon_decimal_point);
    for (const char *c = lconv->mon_decimal_point; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("negative_sign: \"%s\"\n", lconv->negative_sign);
    printf("positive_sign: \"%s\"\n", lconv->positive_sign);
    printf("n_sign_posn: %d\n", lconv->n_sign_posn);
    printf("p_sign_posn: %d\n", lconv->p_sign_posn);
#ifndef _WIN32
    printf("int_n_sign_posn: %d\n", lconv->int_n_sign_posn);
    printf("int_p_sign_posn: %d\n", lconv->int_p_sign_posn);
#endif
    return 0;
}

Sorry about that. It would seem like there are differences in the ru_RU.UTF-8 locale in your installation than in the ones used in CI and in my local environment. What glibc version are you running (as it would seem we require to selectively expect different results on different versions of glibc)?

Can you rerun the put_long_double_ru_RU.pass.cpp test with this diff applied?

diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
index ae5071907aca..a7156e78132e 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
@@ -77,6 +77,9 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
         std::string ex(str, base(iter));
+        for (char c : ex)
+            fprintf(stderr, "%02x ", c);
+        fprintf(stderr, "\n");                 
         assert(ex == "0,00");
     }      
     {   // negative one

Yes, I got

30 2e 30 30

Alternatively, even better, can you provide the output of this test program:

#include <locale.h>
#include <stdio.h>

int main(int argc, char **argv) {
    const char *locale = "ru_RU.UTF-8";
    if (argc > 1)
        locale = argv[1];
    if (!setlocale(LC_ALL, locale)) {
        printf("setlocale(%s) failed\n", locale);
        return 1;
    }
    struct lconv *lconv = localeconv();
    printf("mon_thousands_sep: \"%s\",", lconv->mon_thousands_sep);
    for (const char *c = lconv->mon_thousands_sep; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("thousands_sep: \"%s\",", lconv->thousands_sep);
    for (const char *c = lconv->thousands_sep; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("int_curr_symbol: \"%s\"\n", lconv->int_curr_symbol);
    printf("currency_symbol: \"%s\",", lconv->currency_symbol);
    for (const char *c = lconv->currency_symbol; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("decimal_point: \"%s\",", lconv->decimal_point);
    for (const char *c = lconv->decimal_point; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("mon_decimal_point: \"%s\",", lconv->mon_decimal_point);
    for (const char *c = lconv->mon_decimal_point; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("negative_sign: \"%s\"\n", lconv->negative_sign);
    printf("positive_sign: \"%s\"\n", lconv->positive_sign);
    printf("n_sign_posn: %d\n", lconv->n_sign_posn);
    printf("p_sign_posn: %d\n", lconv->p_sign_posn);
#ifndef _WIN32
    printf("int_n_sign_posn: %d\n", lconv->int_n_sign_posn);
    printf("int_p_sign_posn: %d\n", lconv->int_p_sign_posn);
#endif
    return 0;
}

Yep

mon_thousands_sep: " ", c2 a0
thousands_sep: " ", c2 a0
int_curr_symbol: "RUB "
currency_symbol: "руб", d1 80 d1 83 d0 b1
decimal_point: ",", 2c
mon_decimal_point: ".", 2e
negative_sign: "-"
positive_sign: ""
n_sign_posn: 1
p_sign_posn: 1
int_n_sign_posn: 1
int_p_sign_posn: 1

Alternatively, even better, can you provide the output of this test program:

#include <locale.h>
#include <stdio.h>

int main(int argc, char **argv) {
    const char *locale = "ru_RU.UTF-8";
    if (argc > 1)
        locale = argv[1];
    if (!setlocale(LC_ALL, locale)) {
        printf("setlocale(%s) failed\n", locale);
        return 1;
    }
    struct lconv *lconv = localeconv();
    printf("mon_thousands_sep: \"%s\",", lconv->mon_thousands_sep);
    for (const char *c = lconv->mon_thousands_sep; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("thousands_sep: \"%s\",", lconv->thousands_sep);
    for (const char *c = lconv->thousands_sep; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("int_curr_symbol: \"%s\"\n", lconv->int_curr_symbol);
    printf("currency_symbol: \"%s\",", lconv->currency_symbol);
    for (const char *c = lconv->currency_symbol; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("decimal_point: \"%s\",", lconv->decimal_point);
    for (const char *c = lconv->decimal_point; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("mon_decimal_point: \"%s\",", lconv->mon_decimal_point);
    for (const char *c = lconv->mon_decimal_point; *c; c++)
        printf(" %02x", (unsigned char)*c);
    printf("\n");
    printf("negative_sign: \"%s\"\n", lconv->negative_sign);
    printf("positive_sign: \"%s\"\n", lconv->positive_sign);
    printf("n_sign_posn: %d\n", lconv->n_sign_posn);
    printf("p_sign_posn: %d\n", lconv->p_sign_posn);
#ifndef _WIN32
    printf("int_n_sign_posn: %d\n", lconv->int_n_sign_posn);
    printf("int_p_sign_posn: %d\n", lconv->int_p_sign_posn);
#endif
    return 0;
}

Yep

mon_thousands_sep: " ", c2 a0
thousands_sep: " ", c2 a0
int_curr_symbol: "RUB "
currency_symbol: "руб", d1 80 d1 83 d0 b1
decimal_point: ",", 2c
mon_decimal_point: ".", 2e
negative_sign: "-"
positive_sign: ""
n_sign_posn: 1
p_sign_posn: 1
int_n_sign_posn: 1
int_p_sign_posn: 1

Thanks! I get this:

mon_thousands_sep: " ", e2 80 af
thousands_sep: " ", e2 80 af
int_curr_symbol: "RUB "
currency_symbol: "₽", e2 82 bd
decimal_point: ",", 2c
mon_decimal_point: ",", 2c
negative_sign: "-"
positive_sign: ""
n_sign_posn: 1
p_sign_posn: 1
int_n_sign_posn: 1
int_p_sign_posn: 1

What glibc version do you have? As you're on RHEL, I would expect an older one (mine is on Ubuntu 20.04, with glibc 2.31). There seems to be differences in most fields, in particular in mon_decimal_point here. We already have some conditionals due to the fact that currency_symbol differs for ru_RU.UTF-8 in various glibc versions (apparently with the new form appearing in 2.24), but we never had any glibc conditionals for the differing mon_decimal_point. As that probably would require quite intrusive changes to the test, I guess it's probably best to make the test bail out on such older versions (as it just has been XFAILed forever on that platform before anyway).

What glibc version do you have? As you're on RHEL, I would expect an older one (mine is on Ubuntu 20.04, with glibc 2.31). There seems to be differences in most fields, in particular in mon_decimal_point here. We already have some conditionals due to the fact that currency_symbol differs for ru_RU.UTF-8 in various glibc versions (apparently with the new form appearing in 2.24), but we never had any glibc conditionals for the differing mon_decimal_point. As that probably would require quite intrusive changes to the test, I guess it's probably best to make the test bail out on such older versions (as it just has been XFAILed forever on that platform before anyway).

Seems like it 2.17. ldd on the bult binary says e.g.
libc.so.6 => /lib64/libc.so.6 (0x00007fc160eed000)
and then
-> /lib64/libc.so.6
GNU C Library (GNU libc) stable release version 2.17, by Roland McGrath et al.

What glibc version do you have? As you're on RHEL, I would expect an older one (mine is on Ubuntu 20.04, with glibc 2.31). There seems to be differences in most fields, in particular in mon_decimal_point here. We already have some conditionals due to the fact that currency_symbol differs for ru_RU.UTF-8 in various glibc versions (apparently with the new form appearing in 2.24), but we never had any glibc conditionals for the differing mon_decimal_point. As that probably would require quite intrusive changes to the test, I guess it's probably best to make the test bail out on such older versions (as it just has been XFAILed forever on that platform before anyway).

Seems like it 2.17. ldd on the bult binary says e.g.
libc.so.6 => /lib64/libc.so.6 (0x00007fc160eed000)
and then
-> /lib64/libc.so.6
GNU C Library (GNU libc) stable release version 2.17, by Roland McGrath et al.

Thanks!

I dug around and found that this change stems from https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=f11f2f6e145d6fc6b52f6b0733599f8b96595733, and that commit was part of the 2.27 release.

What glibc version do you have? As you're on RHEL, I would expect an older one (mine is on Ubuntu 20.04, with glibc 2.31). There seems to be differences in most fields, in particular in mon_decimal_point here. We already have some conditionals due to the fact that currency_symbol differs for ru_RU.UTF-8 in various glibc versions (apparently with the new form appearing in 2.24), but we never had any glibc conditionals for the differing mon_decimal_point. As that probably would require quite intrusive changes to the test, I guess it's probably best to make the test bail out on such older versions (as it just has been XFAILed forever on that platform before anyway).

Seems like it 2.17. ldd on the bult binary says e.g.
libc.so.6 => /lib64/libc.so.6 (0x00007fc160eed000)
and then
-> /lib64/libc.so.6
GNU C Library (GNU libc) stable release version 2.17, by Roland McGrath et al.

Thanks!

I dug around and found that this change stems from https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=f11f2f6e145d6fc6b52f6b0733599f8b96595733, and that commit was part of the 2.27 release.

Ok! You'll make a fix for it?