Page MenuHomePhorge

ArcanistBundleTestCase: fix support of non-English environments
ClosedPublic

Authored by valerio.bozzolan on Aug 26 2024, 14:23.

Details

Summary

Recently this unit test was always failing for some specific users.
I was able to reproduce the issue with an Italian unix environment:

arc unit src/parser/__tests__/ArcanistBundleTestCase.php

Obtaining:

EXCEPTION (Exception): Diff Parse Exception: Expected '\ No newline at end of file'.

After this change, the involved unit test always work also in my Italian environment.

Note that the LC_ALL=C means that all localization should be deactivated,
and we should instead use C-sourced strings (not translated in any language). Nice!

Closes T15927

Test Plan

Run the unit test. It does not fail anymore if you are Italian of French or whatever.

Diff Detail

Repository
rARC Arcanist
Branch
master
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1569
Build 1569: arc lint + arc unit

Event Timeline

valerio.bozzolan retitled this revision from ArcanistBundleTestCase: fix support of non-English environments Recently the involved unit test was always failing for some specific users. I was able to reproduce the issue with an Italian unix environment: arc unit... to ArcanistBundleTestCase: fix support of non-English environments.Aug 26 2024, 14:24
valerio.bozzolan edited the summary of this revision. (Show Details)

P.S. try applying D25809 to check if the red unit test becomes green

Ideally, my old eyes would prefer to test this only after all those other noisy unit test exceptions have been resolved (D25800, D25801, D25810, D25811)... but let me try soon

I fail to reproduce a problem locally (after commenting out entire ArcanistBundleTestCase::testGitRepository due to a different issue I'm running into locally).

After installing glibc-langpack-it on my Fedora system (to make locale -a offer something which is not English) I do not get an exception:

[acko@fedora arcanist (master *$%|u=)]$ export LC_ALL=it_IT.utf8
[acko@fedora arcanist (master *$%|u=)]$ export LANG=it_IT.utf8
[acko@fedora arcanist (master *$%|u=)]$ locale
LANG=it_IT.utf8
LC_CTYPE="it_IT.utf8"
LC_NUMERIC="it_IT.utf8"
LC_TIME="it_IT.utf8"
LC_COLLATE="it_IT.utf8"
LC_MONETARY="it_IT.utf8"
LC_MESSAGES="it_IT.utf8"
LC_PAPER="it_IT.utf8"
LC_NAME="it_IT.utf8"
LC_ADDRESS="it_IT.utf8"
LC_TELEPHONE="it_IT.utf8"
LC_MEASUREMENT="it_IT.utf8"
LC_IDENTIFICATION="it_IT.utf8"
LC_ALL=it_IT.utf8
[acko@fedora arcanist (master *$%|u=)]$ ../arcanist/bin/arc unit src/parser/__tests__/ArcanistBundleTestCase.php 
   PASS   45ms★  ArcanistBundleTestCase::testDisjointHunks
   PASS   63ms   ArcanistBundleTestCase::testEncodeBase85
   PASS   31ms★  ArcanistBundleTestCase::testTrailingContext
   PASS   32ms★  ArcanistBundleTestCase::testNonlocalTrailingNewline
   PASS   27ms★  ArcanistBundleTestCase::testTabEncoding
   PASS   36ms★  ArcanistBundleTestCase::testMergeHunks

Maybe maybe this somehow requires running testGitRepository() first? For now it looks like I'm not of any help here. :-/

Thank you for trying. Let's continue the "how to reproduce" discussion in the bug report T15927

mainframe98 subscribed.

Confirmed on KDE on Debian 12, everything set to Dutch: LC_ALL evaluates to nl_NL.UTF-8. Fails before applying this change, succeeds afterwards.

This revision is now accepted and ready to land.Oct 20 2024, 20:43