[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 <dennyje@ornl.gov>
Tue, 29 Oct 2019 19:13:53 +0000 (15:13 -0400)
commit7c1d536c21c7d98be350ffab8353e202c14dcc93
tree3d0c48435c1b13ca303cc4d2164db524a8c85845
parentb163806cdc317ee160a2ce694958c088a949fa7d
[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/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