[lit] Extend internal diff to support `-` argument
authorJoel E. Denny <jdenny.ornl@gmail.com>
Thu, 10 Oct 2019 17:39:57 +0000 (17:39 +0000)
committerJoel E. Denny <jdenny.ornl@gmail.com>
Thu, 10 Oct 2019 17:39:57 +0000 (17:39 +0000)
commitf4edce12fffee221a16c5829b24281b3e23f423d
tree16f574172123f5c9b50e785581a9be71e79b8803
parent19e6bb25f05fa24ea445dd455c7f44fc3b036725
[lit] Extend internal diff to support `-` argument

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 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 `-` as a command-line option.  This patch adds support for
`-` to mean stdin.

Reviewed By: probinson, rnk

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

llvm-svn: 374390
llvm/utils/lit/lit/builtin_commands/diff.py
llvm/utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt
llvm/utils/lit/tests/Inputs/shtest-shell/diff-pipes.txt
llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-7.txt [new file with mode: 0644]
llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-8.txt [new file with mode: 0644]
llvm/utils/lit/tests/max-failures.py
llvm/utils/lit/tests/shtest-shell.py