How to write test requiring a specific locale?
Weijun Wang
weijun.wang at oracle.com
Fri Aug 28 00:35:40 UTC 2015
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
More information about the jtreg-dev
mailing list