diff options
author | Joel E. Denny <jdenny.ornl@gmail.com> | 2019-10-14 19:59:30 +0000 |
---|---|---|
committer | Joel E. Denny <jdenny.ornl@gmail.com> | 2019-10-14 19:59:30 +0000 |
commit | 7e385bd2f526cc04b4a7cc6af1f39744f304d31a (patch) | |
tree | 6c367a1cbab27456171a6bc153b41fe2aac25063 /llvm/utils/lit/tests/Inputs | |
parent | 2b161cd0a4f7fcb5b0328e7c32e834fec821e898 (diff) | |
download | bcm5719-llvm-7e385bd2f526cc04b4a7cc6af1f39744f304d31a.tar.gz bcm5719-llvm-7e385bd2f526cc04b4a7cc6af1f39744f304d31a.zip |
[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: 374814
Diffstat (limited to 'llvm/utils/lit/tests/Inputs')
3 files changed, 40 insertions, 0 deletions
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified-error-0.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified-error-0.txt new file mode 100644 index 00000000000..ee3858a02ba --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified-error-0.txt @@ -0,0 +1,3 @@ +# Check bad -U argument. +# RUN: echo foo > %t +# RUN: diff -U 30.1 %t %t diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified-error-1.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified-error-1.txt new file mode 100644 index 00000000000..e46e8b5783b --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified-error-1.txt @@ -0,0 +1,3 @@ +# Check bad -U argument. +# RUN: echo foo > %t +# RUN: diff -U-1 %t %t diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified.txt new file mode 100644 index 00000000000..a6a7eef3f9b --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified.txt @@ -0,0 +1,34 @@ +# RUN: echo 1 > %t.foo +# RUN: echo 2 >> %t.foo +# RUN: echo 3 >> %t.foo +# RUN: echo 4 >> %t.foo +# RUN: echo 5 >> %t.foo +# RUN: echo 6 foo >> %t.foo +# RUN: echo 7 >> %t.foo +# RUN: echo 8 >> %t.foo +# RUN: echo 9 >> %t.foo +# RUN: echo 10 >> %t.foo +# RUN: echo 11 >> %t.foo + +# RUN: echo 1 > %t.bar +# RUN: echo 2 >> %t.bar +# RUN: echo 3 >> %t.bar +# RUN: echo 4 >> %t.bar +# RUN: echo 5 >> %t.bar +# RUN: echo 6 bar >> %t.bar +# RUN: echo 7 >> %t.bar +# RUN: echo 8 >> %t.bar +# RUN: echo 9 >> %t.bar +# RUN: echo 10 >> %t.bar +# RUN: echo 11 >> %t.bar + +# Default is 3 lines of context. +# RUN: diff -u %t.foo %t.bar && false || true + +# Override default of 3 lines of context. +# RUN: diff -U 2 %t.foo %t.bar && false || true +# RUN: diff -U4 %t.foo %t.bar && false || true +# RUN: diff -U0 %t.foo %t.bar && false || true + +# Fail so lit will print output. +# RUN: false |