Skip to content

Commit e272992

Browse files
author
Thomas Preud'homme
committed
[LNT] Python 3 support: run tests with UTF-8 encoding
Summary: 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. Reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls, leandron, PrzemekWirkus Reviewed By: hubert.reinterpretcast Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D69048
1 parent c9d8405 commit e272992

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/lit.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ try:
3333
except:
3434
build_root = ''
3535
config.environment['PYTHONPATH'] = '%s:%s' % (build_root, src_root)
36+
# LNT needs a UTF-8 locale when running in Python 3 mode. Rely on the host
37+
# environment to provide it rather than assume a specific UTF-8 locale is
38+
# present.
39+
config.environment['LANG'] = os.environ['LANG']
3640
# Don't generate .pyc files when running tests.
3741
config.environment['PYTHONDONTWRITEBYTECODE'] = "1"
3842
config.environment['SUDO_CMD'] = ""

0 commit comments

Comments
 (0)