KEMBAR78
`features.py`: Recognize the `'Czech_Czechia.1250'` locale by StephanTLavavej · Pull Request #5480 · microsoft/STL · GitHub
Skip to content

Conversation

@StephanTLavavej
Copy link
Member

Noticed by @muellerj2 in #5444 (comment). Windows 11 24H2 recognizes the locale name 'Czech_Czechia.1250' and doesn't recognize 'Czech_Czech Republic.1250'. I wasn't able to figure out when this change happened in Windows (a moderate amount of searching turned up nothing, and I even tried GitHub Copilot but it neither provided consistent answers nor cited any authoritative sources I could confirm), but it seems to have happened a while ago. (Presumably after our Python-powered test harness was added in 2020.)

We can assume/require that contributors and maintainers are running modern builds of Win11, and our CI infrastructure is now using Windows Server 2025, so we should switch to looking for the new locale name here. I believe our MSVC-internal infrastructure isn't using Server 2025 yet, but it doesn't use the Python-powered test harness, so this is irrelevant for it. (It doesn't even understand "REQUIRES" lines.)

Additionally, I have a logic cleanup to simplify how we add locale features. This just uses an if-statement instead of a when-lambda. It also uses a formatted string literal for clarity.

To validate this, I ran the test directories that require the cs_CZ.ISO8859-2 locale:

python tests\utils\stl-lit\stl-lit.py -o testing_x64.log -Dnotags=ASAN --order=random %STL%\llvm-project\libcxx\test\std\re\re.traits %STL%\llvm-project\libcxx\test\std\re\re.alg\re.alg.search %STL%\llvm-project\libcxx\test\std\re\re.alg\re.alg.match

There are 132 total discovered tests here. I then compared main, #5444, this PR, and #5444 merged with this PR:

Result main #5444 This PR Both PRs
Skipped 44 44 44 44
Unsupported 22 22 0 0
Passed 46 46 48 50
Expectedly Failed 20 20 40 38

This just uses an if-statement instead of a when-lambda. It also uses a formatted string literal for clarity.
@muellerj2
Copy link
Contributor

I see one potential argument to resolve this differently: The locale setup in the test harness seems to have been adapted almost verbatim from libc++'s, so libc++'s test harness suffers from the same bug. If we resolve this issue in the same way as libc++, it might make it a little bit easier to sync changes from upstream in the future.

But I guess it's also a valid argument that the test setups have accumulated so many differences that another minor one doesn't matter.

@StephanTLavavej
Copy link
Member Author

I'm open to a "better" fix, I just don't know what it would look like. Our feature-setup logic is very different.

@muellerj2
Copy link
Contributor

muellerj2 commented May 8, 2025

If you think they have diverged too much, then there isn't much point in trying to keep the code as closely aligned as possible. Your code certainly looks cleaner.

The MSVC STL test harness also appears to be missing some locale-related compile flags that were recently added to libcxx tests, like this one in std\localization\locale.categories\category.monetary\locale.money.get\locale.money.get.members\get_long_double_fr_FR.pass.cpp:

// ADDITIONAL_COMPILE_FLAGS: -DFR_MON_THOU_SEP=%{LOCALE_CONV_FR_FR_UTF_8_MON_THOUSANDS_SEP}

The necessary logic for these flags was added to the original locale processing code in libc++'s features.py here.

We should add some equivalent logic to features.py as well (but probably not in this PR).

Copy link
Member

@MahmoudGSaleh MahmoudGSaleh left a comment

Choose a reason for hiding this comment

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

LGTM

@StephanTLavavej StephanTLavavej moved this from Final Review to Ready To Merge in STL Code Reviews May 9, 2025
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews May 9, 2025
@StephanTLavavej
Copy link
Member Author

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

StephanTLavavej added a commit to StephanTLavavej/STL that referenced this pull request May 9, 2025
@StephanTLavavej StephanTLavavej merged commit a9ae27f into microsoft:main May 10, 2025
39 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews May 10, 2025
@StephanTLavavej StephanTLavavej deleted the czechia branch May 10, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Related to test code

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants