How to write test requiring a specific locale?
Jonathan Gibbons
jonathan.gibbons at oracle.com
Tue Sep 1 20:46:45 UTC 2015
On 08/27/2015 05:35 PM, Weijun Wang wrote:
> Hi All
>
> In https://bugs.openjdk.java.net/browse/JDK-8133910, the test tries to
> grep certain text from tool output, but when the default locale is not
> "en_US" it might fail.
>
> I don't want to rewrite the test to check localized text so there are
> only 2 ways:
>
> 1. Force the text to run with "en_US". In Unix, seems setting LANG or
> LC_ALL to "en_US.UTF-8" (these are script tests), but it does not work
> on Windows. I can only think of adding "-J-Duser.language=en
> -J-Duser.country=US" into TESTTOOLVMOPTS.
>
> 2. Ignore the text when locale is not en_US. The @requires tag does
> not support user.encoding. Shall I check $LANG or $LC_ALL? Should they
> contain "en_US" on most test machines? Or it's "C"?
>
> Thanks
> Max
It would be easy enough to make jtreg @requires understand user.encoding.
-- Jon
More information about the jtreg-dev
mailing list