Skip to content

[llvm-lit][test] Precommit tests for curly braces in lit internal shell #102976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Test closing brace without open brace.
# RUN: echo foo; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Test open brace without closing brace.
# RUN: { echo foo
19 changes: 19 additions & 0 deletions llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace.txt
Original file line number Diff line number Diff line change
@@ -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
20 changes: 19 additions & 1 deletion llvm/utils/lit/tests/shtest-shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -635,4 +653,4 @@

# CHECK: PASS: shtest-shell :: valid-shell.txt
# CHECK: Unresolved Tests (1)
# CHECK: Failed Tests (36)
# CHECK: Failed Tests (39)
Loading