Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test by make sorting independent of locale and case #9640

Merged
merged 3 commits into from
Sep 19, 2024

Conversation

pabzm
Copy link
Member

@pabzm pabzm commented Sep 17, 2024

These tests have been failing locally repeatedly. This fixes them and also works in the CI.

@pabzm
Copy link
Member Author

pabzm commented Sep 17, 2024

@alecpl Do you have a comment on this? I'm not really sure why you chose a case-sensitive comparing function in the first place.

@alecpl
Copy link
Member

alecpl commented Sep 18, 2024

We use strcoll because it is locale-aware.

@pabzm
Copy link
Member Author

pabzm commented Sep 18, 2024

But then we cannot compare its output with a fixed list, right? Because the output depends on the locale?

@alecpl
Copy link
Member

alecpl commented Sep 18, 2024

The solution is to set locale in the test.

@pabzm
Copy link
Member Author

pabzm commented Sep 18, 2024

I tried without success.

putenv('LANG=C');
putenv('LC_ALL=C');
$_ENV['LANG'] = 'C';
$_ENV['LC_ALL'] = 'C';
setlocale(\LC_ALL, 'C');

These all don't help, neither with C.UTF-8 nor en_US.UTF-8. Which one is correct needle for this haystack?

I still don't understand what we gain from depending our test result on one specific locale, which we then have to pin in our test?

@alecpl
Copy link
Member

alecpl commented Sep 18, 2024

The test works with setlocale(\LC_ALL, 'en_US.UTF-8'), but you have to have this locale installed in the system. It fails with 'C' locale.

Feel free to modify the test to pass (e.g. use upper-case where needed), but I don't think we should change the sorting algorithm.

One of the IMAP tests curiuosly ran successfully on Github-runners, but
failed locally. This is the pre-condition for a fix.
@pabzm pabzm force-pushed the fix-imap-test-sorting branch 2 times, most recently from 83a4b3c to 6b296bb Compare September 18, 2024 18:09
This test works only if executed with LC_COLLATE=en_US
@pabzm
Copy link
Member Author

pabzm commented Sep 18, 2024

Does this work for you?

@alecpl alecpl merged commit d31c536 into roundcube:master Sep 19, 2024
16 checks passed
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.

2 participants