[lit] Extend internal diff to support -U
authorJoel E. Denny <jdenny.ornl@gmail.com>
Thu, 10 Oct 2019 17:40:12 +0000 (17:40 +0000)
committerJoel E. Denny <jdenny.ornl@gmail.com>
Thu, 10 Oct 2019 17:40:12 +0000 (17:40 +0000)
commit61d7ecbf84c7deb91752216b82fbb69715b6830a
tree734504c6e7210ee4f1354a404363da7793a7abd2
parenta134d3cfc9d4f3a2db0023f3a6da53d52008c5f5
[lit] Extend internal diff to support -U

When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff -U1 file -
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` doesn't
recognize `-U` as a command-line option.  This patch adds `-U`
support.

Reviewed By: rnk

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

llvm-svn: 374392
llvm/utils/lit/lit/builtin_commands/diff.py
llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified.txt [new file with mode: 0644]
llvm/utils/lit/tests/max-failures.py
llvm/utils/lit/tests/shtest-shell.py