]> granicus.if.org Git - llvm/commit
[lit] Fix internal diff's --strip-trailing-cr and use it
authorJoel E. Denny <jdenny.ornl@gmail.com>
Wed, 16 Oct 2019 17:21:57 +0000 (17:21 +0000)
committerJoel E. Denny <jdenny.ornl@gmail.com>
Wed, 16 Oct 2019 17:21:57 +0000 (17:21 +0000)
commite65499709f28f65a0edf7e8918fa35348b2d00c0
tree5e3ac32792fed324992b6fb2ff2a5d57a374a413
parent9fd31ce525da5b3531e156722b496865f4370569
[lit] Fix internal diff's --strip-trailing-cr and use it

Using GNU diff, `--strip-trailing-cr` removes a `\r` appearing before
a `\n` at the end of a line.  Without this patch, lit's internal diff
only removes `\r` if it appears as the last character.  That seems
useless.  This patch fixes that.

This patch also adds `--strip-trailing-cr` to some tests that fail on
Windows bots when D68664 is applied.  Based on what I see in the bot
logs, I think the following is happening.  In each test there, lit
diff is comparing a file with `\r\n` line endings to a file with `\n`
line endings.  Without D68664, lit diff reads those files in text
mode, which in Windows causes `\r\n` to be replaced with `\n`.
However, with D68664, lit diff reads the files in binary mode instead
and thus reports that every line is different, just as GNU diff does
(at least under Ubuntu).  Adding `--strip-trailing-cr` to those tests
restores the previous behavior while permitting the behavior of lit
diff to be more like GNU diff.

Reviewed By: rnk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375020 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
test/MC/ARM/preserve-comments-arm.s
test/MC/AsmParser/preserve-comments.s
test/tools/llvm-cxxmap/remap.test
test/tools/llvm-profdata/profile-symbol-list.test
test/tools/llvm-profdata/roundtrip.test
test/tools/llvm-profdata/sample-remap.test
utils/lit/lit/TestRunner.py
utils/lit/tests/Inputs/shtest-shell/diff-in.dos [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-shell/diff-in.unix [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-shell/diff-strip-trailing-cr.txt [new file with mode: 0644]
utils/lit/tests/max-failures.py
utils/lit/tests/shtest-shell.py