summaryrefslogtreecommitdiffstats
path: root/libcxx/test/lit.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/lit.cfg')
-rw-r--r--libcxx/test/lit.cfg37
1 files changed, 37 insertions, 0 deletions
diff --git a/libcxx/test/lit.cfg b/libcxx/test/lit.cfg
index 4b7b4705978..51c1ff56305 100644
--- a/libcxx/test/lit.cfg
+++ b/libcxx/test/lit.cfg
@@ -3,6 +3,7 @@
# Configuration file for the 'lit' test runner.
import errno
+import locale
import os
import platform
import re
@@ -175,6 +176,42 @@ config.suffixes = ['.cpp']
# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)
+# Figure out which of the required locales we support
+locales = {
+ 'Darwin': {
+ 'en_US.UTF-8': 'en_US.UTF-8',
+ 'cs_CZ.ISO8859-2': 'cs_CZ.ISO8859-2',
+ 'fr_FR.UTF-8': 'fr_FR.UTF-8',
+ 'fr_CA.ISO8859-1': 'cs_CZ.ISO8859-1',
+ 'ru_RU.UTF-8': 'ru_RU.UTF-8',
+ 'zh_CN.UTF-8': 'zh_CN.UTF-8',
+ },
+ 'Linux': {
+ 'en_US.UTF-8': 'en_US.UTF-8',
+ 'cs_CZ.ISO8859-2': 'cs_CZ.ISO-8859-2',
+ 'fr_FR.UTF-8': 'fr_FR.UTF-8',
+ 'fr_CA.ISO8859-1': 'fr_CA.ISO-8859-1',
+ 'ru_RU.UTF-8': 'ru_RU.UTF-8',
+ 'zh_CN.UTF-8': 'zh_CN.UTF-8',
+ },
+ 'Windows': {
+ 'en_US.UTF-8': 'English_United States.1252',
+ 'cs_CZ.ISO8859-2': 'Czech_Czech Republic.1250',
+ 'fr_FR.UTF-8': 'French_France.1252',
+ 'fr_CA.ISO8859-1': 'French_Canada.1252',
+ 'ru_RU.UTF-8': 'Russian_Russia.1251',
+ 'zh_CN.UTF-8': 'Chinese_China.936',
+ },
+}
+
+for feature, loc in locales[platform.system()].items():
+ try:
+ locale.setlocale(locale.LC_ALL, loc)
+ config.available_features.add('locale.{}'.format(feature))
+ except:
+ lit_config.warning('The locale {} is not supported by your platoform. '
+ 'Some tests will be unsupported.'.format(loc))
+
# Gather various compiler parameters.
cxx_under_test = lit_config.params.get('cxx_under_test', None)
if cxx_under_test is None:
OpenPOWER on IntegriCloud