[llvm] [llvm-lit][test] Precommit tests for curly braces in lit internal shell (PR #102976)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 10:38:27 PDT 2024
https://github.com/connieyzhu updated https://github.com/llvm/llvm-project/pull/102976
>From c80249b1b24729f11e9422dbb469d24e292e667c Mon Sep 17 00:00:00 2001
From: Connie Zhu <connieyzhu at google.com>
Date: Mon, 12 Aug 2024 20:45:06 +0000
Subject: [PATCH] [llvm-lit][test] Precommit tests for curly braces in lit
internal shell
This patch creates tests to check lit's failure to execute curly braces
{}.
---
.../lit/tests/Inputs/shtest-shell/curly-brace.txt | 12 ++++++++++++
llvm/utils/lit/tests/shtest-shell.py | 8 +++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
create mode 100644 llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace.txt
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 00000000000000..24a99f4b9547ad
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-shell/curly-brace.txt
@@ -0,0 +1,12 @@
+## 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: bar
\ No newline at end of file
diff --git a/llvm/utils/lit/tests/shtest-shell.py b/llvm/utils/lit/tests/shtest-shell.py
index 8f2b865f333a57..bb67388e608d93 100644
--- a/llvm/utils/lit/tests/shtest-shell.py
+++ b/llvm/utils/lit/tests/shtest-shell.py
@@ -28,6 +28,12 @@
# CHECK: PASS: shtest-shell :: continuations.txt
+# 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 +641,4 @@
# CHECK: PASS: shtest-shell :: valid-shell.txt
# CHECK: Unresolved Tests (1)
-# CHECK: Failed Tests (36)
+# CHECK: Failed Tests (37)
More information about the llvm-commits
mailing list