]> granicus.if.org Git - llvm/commit
[lit] Make internal diff work in pipelines
authorJoel E. Denny <jdenny.ornl@gmail.com>
Thu, 17 Oct 2019 14:02:42 +0000 (14:02 +0000)
committerJoel E. Denny <jdenny.ornl@gmail.com>
Thu, 17 Oct 2019 14:02:42 +0000 (14:02 +0000)
commit80b7aace9f29deb93532c0b2ac1376dc1d0e3958
tree81151a0f5f514179b72c9ab8bb7cf9e6de4520a4
parenta0544616ea2f08791aae4ce357e646c3396f8149
[lit] Make internal diff work in pipelines

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 -
 # RUN: not diff file1 file2 | FileCheck %s
```

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` cannot
currently be used in pipelines and doesn't recognize `-` as a
command-line option.

To enable pipelines, this patch moves lit's `diff` implementation into
an out-of-process script, similar to lit's `cat` implementation.  A
follow-up patch will implement `-` to mean stdin.

Reviewed By: probinson, stella.stamenova

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375114 91177308-0d34-0410-b5e6-96231b3b80d8
utils/lit/lit/TestRunner.py
utils/lit/lit/builtin_commands/diff.py [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-shell/diff-error-0.txt [deleted file]
utils/lit/tests/Inputs/shtest-shell/diff-pipes.txt [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-shell/diff-unified-error-0.txt [deleted file]
utils/lit/tests/Inputs/shtest-shell/diff-unified-error-1.txt [deleted file]
utils/lit/tests/Inputs/shtest-shell/diff-unified.txt
utils/lit/tests/max-failures.py
utils/lit/tests/shtest-shell.py