[lit] Extend internal diff to support `-` argument
authorJoel E. Denny <jdenny.ornl@gmail.com>
Thu, 17 Oct 2019 14:03:06 +0000 (14:03 +0000)
committerJoel E. Denny <jdenny.ornl@gmail.com>
Thu, 17 Oct 2019 14:03:06 +0000 (14:03 +0000)
commit849d67a70080982cc1261759015a67b06b25eb16
tree2a6a96f47200d016924ccd93470d9cc77e9052e3
parent221e418f0c56d6b4a8b188fb4d8e75e21f7b0c8d
[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: 375116
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