]> granicus.if.org Git - llvm/commit
[lit] Clean up internal diff's encoding handling
authorJoel E. Denny <jdenny.ornl@gmail.com>
Wed, 16 Oct 2019 17:21:24 +0000 (17:21 +0000)
committerJoel E. Denny <jdenny.ornl@gmail.com>
Wed, 16 Oct 2019 17:21:24 +0000 (17:21 +0000)
commit53ed4a35c6274bdfef7ab92c407ab5639036c151
treebf30addbfbf65d3ad9f131d627cce6756b53938e
parent4bac211dcafc591c3e216bd3f15044a476301160
[lit] Clean up internal diff's encoding handling

As suggested by rnk at D67643#1673043, instead of reading files
multiple times until an appropriate encoding is found, read them once
as binary, and then try to decode what was read.

For Python >= 3.5, don't fail when attempting to decode the
`diff_bytes` output in order to print it.

Avoid failures for Python 2.7 used on some Windows bots by
transforming diff output with `lit.util.to_string` before writing it
to stdout.

Finally, add some tests for encoding handling.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D68664

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375018 91177308-0d34-0410-b5e6-96231b3b80d8
utils/lit/lit/TestRunner.py
utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-shell/diff-in.bin [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-shell/diff-in.utf16 [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-shell/diff-in.utf8 [new file with mode: 0644]
utils/lit/tests/max-failures.py
utils/lit/tests/shtest-shell.py