diff options
-rw-r--r-- | llvm/utils/lit/lit/TestRunner.py | 7 | ||||
-rw-r--r-- | llvm/utils/lit/tests/Inputs/shtest-format/external_shell/utf8_command.txt | 3 | ||||
-rw-r--r-- | llvm/utils/lit/tests/shtest-format.py | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index ab0df517bff..fdaaa922d55 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -1133,9 +1133,12 @@ def executeScript(test, litConfig, tmpBase, commands, cwd): # Write script file mode = 'w' + open_kwargs = {} if litConfig.isWindows and not isWin32CMDEXE: - mode += 'b' # Avoid CRLFs when writing bash scripts. - f = open(script, mode) + mode += 'b' # Avoid CRLFs when writing bash scripts. + elif sys.version_info > (3,0): + open_kwargs['encoding'] = 'utf-8' + f = open(script, mode, **open_kwargs) if isWin32CMDEXE: for i, ln in enumerate(commands): commands[i] = re.sub(kPdbgRegex, "echo '\\1' > nul && ", ln) diff --git a/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/utf8_command.txt b/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/utf8_command.txt new file mode 100644 index 00000000000..cec0b389603 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/utf8_command.txt @@ -0,0 +1,3 @@ +# Run a command including UTF-8 characters. +# +# RUN: echo £ diff --git a/llvm/utils/lit/tests/shtest-format.py b/llvm/utils/lit/tests/shtest-format.py index 0031ccf711b..4f628dc7242 100644 --- a/llvm/utils/lit/tests/shtest-format.py +++ b/llvm/utils/lit/tests/shtest-format.py @@ -80,7 +80,7 @@ # CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt # CHECK: shtest-format :: fail.txt -# CHECK: Expected Passes : 7 +# CHECK: Expected Passes : 8 # CHECK: Expected Failures : 4 # CHECK: Unsupported Tests : 5 # CHECK: Unresolved Tests : 3 @@ -90,7 +90,7 @@ # XUNIT: <?xml version="1.0" encoding="UTF-8" ?> # XUNIT-NEXT: <testsuites> -# XUNIT-NEXT: <testsuite name="shtest-format" tests="23" failures="7" skipped="5"> +# XUNIT-NEXT: <testsuite name="shtest-format" tests="24" failures="7" skipped="5"> # XUNIT: <testcase classname="shtest-format.shtest-format" name="argv0.txt" time="{{[0-9]+\.[0-9]+}}"/> |