[PATCH] D69048: [LNT] Python 3 support: run tests with UTF-8 encoding
Thomas Preud'homme via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 16 08:55:06 PDT 2019
thopre created this revision.
thopre added reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls.
thopre added a parent revision: D69042: [LNT] Python 3 support: define hash for Order class.
Click requires to be invoked with a default encoding of UTF-8. If not,
it exists the program with an error. This commit sets the LANG
environment variable for running lit tests to the system locale if it is
a UTF-8 capable one or en_US.UTF-8 as a fallback. This allows the test
to run on systems where en_US.UTF-8 is not installed (such as some
container images) but the default locale is UTF-8 capable.
https://reviews.llvm.org/D69048
Files:
tests/lit.cfg
Index: tests/lit.cfg
===================================================================
--- tests/lit.cfg
+++ tests/lit.cfg
@@ -33,6 +33,10 @@
except:
build_root = ''
config.environment['PYTHONPATH'] = '%s:%s' % (build_root, src_root)
+if 'LANG' in os.environ and os.environ['LANG'].endswith('.UTF-8'):
+ config.environment['LANG'] = os.environ['LANG']
+else:
+ config.environment['LANG'] = 'en_US.UTF-8'
# Don't generate .pyc files when running tests.
config.environment['PYTHONDONTWRITEBYTECODE'] = "1"
config.environment['SUDO_CMD'] = ""
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69048.225239.patch
Type: text/x-patch
Size: 558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191016/14c8718a/attachment.bin>
More information about the llvm-commits
mailing list