diff options
Diffstat (limited to 'llvm/utils/lit/tests')
5 files changed, 122 insertions, 2 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 diff --git a/llvm/utils/lit/tests/max-failures.py b/llvm/utils/lit/tests/max-failures.py index cee06fa255d..7bd5c32e72e 100644 --- a/llvm/utils/lit/tests/max-failures.py +++ b/llvm/utils/lit/tests/max-failures.py @@ -8,7 +8,7 @@ # # END. -# CHECK: Failing Tests (27) +# CHECK: Failing Tests (30) # CHECK: Failing Tests (1) # CHECK: Failing Tests (2) # CHECK: error: argument --max-failures: requires positive integer, but found '0' diff --git a/llvm/utils/lit/tests/shtest-shell.py b/llvm/utils/lit/tests/shtest-shell.py index f947525e591..d1fcaefc8cd 100644 --- a/llvm/utils/lit/tests/shtest-shell.py +++ b/llvm/utils/lit/tests/shtest-shell.py @@ -149,6 +149,86 @@ # CHECK: PASS: shtest-shell :: diff-r.txt +# CHECK: FAIL: shtest-shell :: diff-unified-error-0.txt +# CHECK: *** TEST 'shtest-shell :: diff-unified-error-0.txt' FAILED *** +# CHECK: $ "diff" "-U" "30.1" "{{[^"]*}}" "{{[^"]*}}" +# CHECK: # command stderr: +# CHECK: Error: invalid '-U' argument: 30.1 +# CHECK: error: command failed with exit status: 127 +# CHECK: *** + +# CHECK: FAIL: shtest-shell :: diff-unified-error-1.txt +# CHECK: *** TEST 'shtest-shell :: diff-unified-error-1.txt' FAILED *** +# CHECK: $ "diff" "-U-1" "{{[^"]*}}" "{{[^"]*}}" +# CHECK: # command stderr: +# CHECK: Error: invalid '-U' argument: -1 +# CHECK: error: command failed with exit status: 127 +# CHECK: *** + + +# CHECK: FAIL: shtest-shell :: diff-unified.txt + +# CHECK: *** TEST 'shtest-shell :: diff-unified.txt' FAILED *** + +# CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "{{[^"]*}}.bar" +# CHECK: # command output: +# CHECK: @@ {{.*}} @@ +# CHECK-NEXT: 3 +# CHECK-NEXT: 4 +# CHECK-NEXT: 5 +# CHECK-NEXT: -6 foo +# CHECK-NEXT: +6 bar +# CHECK-NEXT: 7 +# CHECK-NEXT: 8 +# CHECK-NEXT: 9 +# CHECK-EMPTY: +# CHECK-NEXT: error: command failed with exit status: 1 +# CHECK-NEXT: $ "true" + +# CHECK: $ "diff" "-U" "2" "{{[^"]*}}.foo" "{{[^"]*}}.bar" +# CHECK: # command output: +# CHECK: @@ {{.*}} @@ +# CHECK-NEXT: 4 +# CHECK-NEXT: 5 +# CHECK-NEXT: -6 foo +# CHECK-NEXT: +6 bar +# CHECK-NEXT: 7 +# CHECK-NEXT: 8 +# CHECK-EMPTY: +# CHECK-NEXT: error: command failed with exit status: 1 +# CHECK-NEXT: $ "true" + +# CHECK: $ "diff" "-U4" "{{[^"]*}}.foo" "{{[^"]*}}.bar" +# CHECK: # command output: +# CHECK: @@ {{.*}} @@ +# CHECK-NEXT: 2 +# CHECK-NEXT: 3 +# CHECK-NEXT: 4 +# CHECK-NEXT: 5 +# CHECK-NEXT: -6 foo +# CHECK-NEXT: +6 bar +# CHECK-NEXT: 7 +# CHECK-NEXT: 8 +# CHECK-NEXT: 9 +# CHECK-NEXT: 10 +# CHECK-EMPTY: +# CHECK-NEXT: error: command failed with exit status: 1 +# CHECK-NEXT: $ "true" + +# CHECK: $ "diff" "-U0" "{{[^"]*}}.foo" "{{[^"]*}}.bar" +# CHECK: # command output: +# CHECK: @@ {{.*}} @@ +# CHECK-NEXT: -6 foo +# CHECK-NEXT: +6 bar +# CHECK-EMPTY: +# CHECK-NEXT: error: command failed with exit status: 1 +# CHECK-NEXT: $ "true" + +# CHECK: $ "false" + +# CHECK: *** + + # CHECK: FAIL: shtest-shell :: error-0.txt # CHECK: *** TEST 'shtest-shell :: error-0.txt' FAILED *** # CHECK: $ "not-a-real-command" @@ -228,4 +308,4 @@ # CHECK: PASS: shtest-shell :: sequencing-0.txt # CHECK: XFAIL: shtest-shell :: sequencing-1.txt # CHECK: PASS: shtest-shell :: valid-shell.txt -# CHECK: Failing Tests (27) +# CHECK: Failing Tests (30) |