summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorJoel E. Denny <jdenny.ornl@gmail.com>2019-10-12 16:00:35 +0000
committerJoel E. Denny <jdenny.ornl@gmail.com>2019-10-12 16:00:35 +0000
commita271acbf79326da83cab36a02938fc6cd5740b1b (patch)
tree42785a412d9cb53285998bc00a5d9778c82d4271 /llvm/utils
parent8259f7ca120734b6fba0e67ae445492009f9871d (diff)
downloadbcm5719-llvm-a271acbf79326da83cab36a02938fc6cd5740b1b.tar.gz
bcm5719-llvm-a271acbf79326da83cab36a02938fc6cd5740b1b.zip
[lit] Try yet again to fix new tests that fail on Windows bots
I seem to have misread the bot logs on my last attempt. When lit's internal diff runs on Windows under Python 2.7, it's text diffs not binary diffs that need decoding to avoid this error when writing the diff to stdout: ``` UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128) ``` There is no `decode` attribute in this case under Python 3.6.8 under Ubuntu, so this patch checks for the `decode` attribute before using it here. Hopefully nothing else is needed when `decode` isn't available. It might take a couple more attempts to figure out what error handling, if any, is needed for this decoding. llvm-svn: 374665
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/lit/lit/builtin_commands/diff.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/utils/lit/lit/builtin_commands/diff.py b/llvm/utils/lit/lit/builtin_commands/diff.py
index f413f87425c..ee933d8e59e 100644
--- a/llvm/utils/lit/lit/builtin_commands/diff.py
+++ b/llvm/utils/lit/lit/builtin_commands/diff.py
@@ -95,6 +95,9 @@ def compareTwoTextFiles(flags, filepaths, filelines_bin, encoding):
func = difflib.unified_diff if flags.unified_diff else difflib.context_diff
for diff in func(filelines[0], filelines[1], filepaths[0], filepaths[1],
n = flags.num_context_lines):
+ if hasattr(diff, 'decode'):
+ # python 2.7
+ diff = diff.decode()
sys.stdout.write(diff)
exitCode = 1
return exitCode
OpenPOWER on IntegriCloud