diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace-close-only.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace-close-only.txt new file mode 100644 index 0000000000000..35c846847d2f4 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace-close-only.txt @@ -0,0 +1,2 @@ +## Test closing brace without open brace. +# RUN: echo foo; } diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace-open-only.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace-open-only.txt new file mode 100644 index 0000000000000..ce04704f3c33e --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace-open-only.txt @@ -0,0 +1,2 @@ +## Test open brace without closing brace. +# RUN: { echo foo diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace.txt new file mode 100644 index 0000000000000..69b6e75fe79b9 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace.txt @@ -0,0 +1,19 @@ +## Test curly braces used in grouping commands. + +## Test one command inside curly brace. +# RUN: { echo bar; } | FileCheck --check-prefix=ONE-CMD %s + +# ONE-CMD: bar + +## Test two commands inside curly brace. +# RUN: { echo foo; echo bar; } | FileCheck --check-prefix=TWO-CMDS %s + +# TWO-CMDS: foo +# TWO-CMDS-NEXT: bar + +## Test nested curly brace. +# RUN: { echo foo > %t; { echo bar; echo baz; }; cat %t; } | FileCheck --check-prefix=NESTED %s + +# NESTED: bar +# NESTED-NEXT: baz +# NESTED-NEXT: foo diff --git a/llvm/utils/lit/tests/shtest-shell.py b/llvm/utils/lit/tests/shtest-shell.py index 8f2b865f333a5..bc34df9c3f9a7 100644 --- a/llvm/utils/lit/tests/shtest-shell.py +++ b/llvm/utils/lit/tests/shtest-shell.py @@ -28,6 +28,24 @@ # CHECK: PASS: shtest-shell :: continuations.txt +# CHECK: FAIL: shtest-shell :: curly-brace-close-only.txt +# CHECK: # executed command: '}' +# CHECK-NEXT: # .---command stderr------------ +# CHECK-NEXT: # | '}': command not found +# CHECK: error: command failed with exit status: 127 + +# CHECK: FAIL: shtest-shell :: curly-brace-open-only.txt +# CHECK: # executed command: '{' echo foo +# CHECK-NEXT: # .---command stderr------------ +# CHECK-NEXT: # | '{': command not found +# CHECK: error: command failed with exit status: 127 + +# CHECK: FAIL: shtest-shell :: curly-brace.txt +# CHECK: # executed command: '{' echo bar +# CHECK-NEXT: # .---command stderr------------ +# CHECK-NEXT: # | '{': command not found +# CHECK: error: command failed with exit status: 127 + # CHECK: PASS: shtest-shell :: dev-null.txt # CHECK: FAIL: shtest-shell :: diff-b.txt @@ -635,4 +653,4 @@ # CHECK: PASS: shtest-shell :: valid-shell.txt # CHECK: Unresolved Tests (1) -# CHECK: Failed Tests (36) +# CHECK: Failed Tests (39)