diff options
author | Joel E. Denny <jdenny.ornl@gmail.com> | 2019-10-10 17:39:41 +0000 |
---|---|---|
committer | Joel E. Denny <jdenny.ornl@gmail.com> | 2019-10-10 17:39:41 +0000 |
commit | 19e6bb25f05fa24ea445dd455c7f44fc3b036725 (patch) | |
tree | 25be78f2d0df70fccaff0effd501c06d108b710c /llvm/utils/lit/tests/Inputs | |
parent | df35ec8289eec85e9a551578b1b7ae35b214860f (diff) | |
download | bcm5719-llvm-19e6bb25f05fa24ea445dd455c7f44fc3b036725.tar.gz bcm5719-llvm-19e6bb25f05fa24ea445dd455c7f44fc3b036725.zip |
[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.
Finally, add some tests for encoding handling.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D68664
llvm-svn: 374389
Diffstat (limited to 'llvm/utils/lit/tests/Inputs')
-rw-r--r-- | llvm/utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt | 9 | ||||
-rw-r--r-- | llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.bin | bin | 0 -> 26 bytes | |||
-rw-r--r-- | llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.utf16 | bin | 0 -> 24 bytes | |||
-rw-r--r-- | llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.utf8 | 3 |
4 files changed, 12 insertions, 0 deletions
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt new file mode 100644 index 00000000000..d8b9718a099 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt @@ -0,0 +1,9 @@ +# Check that diff falls back to binary mode if it cannot decode a file. + +# RUN: diff -u diff-in.bin diff-in.bin +# RUN: diff -u diff-in.utf16 diff-in.bin && false || true +# RUN: diff -u diff-in.utf8 diff-in.bin && false || true +# RUN: diff -u diff-in.bin diff-in.utf8 && false || true + +# Fail so lit will print output. +# RUN: false diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.bin b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.bin Binary files differnew file mode 100644 index 00000000000..06b800b707c --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.bin diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.utf16 b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.utf16 Binary files differnew file mode 100644 index 00000000000..d7d9feefa7d --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.utf16 diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.utf8 b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.utf8 new file mode 100644 index 00000000000..86e041dad66 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-in.utf8 @@ -0,0 +1,3 @@ +foo +bar +baz |