[llvm] [lit] Move pipefail test into lit tests (PR #157223)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 7 10:43:47 PDT 2025


https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/157223

>From 37f9edf38403ed84e417e9f242da0e877d58c101 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sat, 6 Sep 2025 04:35:29 +0000
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.6
---
 llvm/test/Other/pipefail.txt                          | 2 --
 llvm/utils/lit/tests/Inputs/shtest-shell/pipefail.txt | 4 ++++
 llvm/utils/lit/tests/shtest-shell.py                  | 8 +++++++-
 3 files changed, 11 insertions(+), 3 deletions(-)
 delete mode 100644 llvm/test/Other/pipefail.txt
 create mode 100644 llvm/utils/lit/tests/Inputs/shtest-shell/pipefail.txt

diff --git a/llvm/test/Other/pipefail.txt b/llvm/test/Other/pipefail.txt
deleted file mode 100644
index 241080aab661c..0000000000000
--- a/llvm/test/Other/pipefail.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-REQUIRES: shell
-RUN: ((false | true) && echo true || echo false) | grep false
diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/pipefail.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/pipefail.txt
new file mode 100644
index 0000000000000..b0d9dee4a2ced
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-shell/pipefail.txt
@@ -0,0 +1,4 @@
+# Check that we fail if earlier operations in a pipe fail.
+#
+# RUN: false | echo test
+#
\ 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 b8bdc6e532e3d..f964e8542db07 100644
--- a/llvm/utils/lit/tests/shtest-shell.py
+++ b/llvm/utils/lit/tests/shtest-shell.py
@@ -1,6 +1,7 @@
 # Check the internal shell handling component of the ShTest format.
 
 # RUN: not %{lit} -v %{inputs}/shtest-shell > %t.out
+# RUN: cat %t.out > /tmp/test
 # RUN: FileCheck --input-file %t.out %s
 #
 # Test again in non-UTF shell to catch potential errors with python 2 seen
@@ -580,6 +581,11 @@
 # CHECK: # error: command failed with exit status: 127
 # CHECK: ***
 
+# CHECK: FAIL: shtest-shell :: pipefail.txt
+# CHECK: *** TEST 'shtest-shell :: pipefail.txt' FAILED ***
+# CHECK: error: command failed with exit status: 1
+# CHECK: ***
+
 # CHECK: PASS: shtest-shell :: redirects.txt
 
 # CHECK: FAIL: shtest-shell :: rm-error-0.txt
@@ -629,4 +635,4 @@
 
 # CHECK: PASS: shtest-shell :: valid-shell.txt
 # CHECK: Unresolved Tests (1)
-# CHECK: Failed Tests (36)
+# CHECK: Failed Tests (37)

>From 0e07a41eff44c35eaafa210f9bdc27a11f096283 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sun, 7 Sep 2025 17:43:37 +0000
Subject: [PATCH 2/2] fix

Created using spr 1.3.6
---
 llvm/utils/lit/tests/shtest-shell.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/llvm/utils/lit/tests/shtest-shell.py b/llvm/utils/lit/tests/shtest-shell.py
index f964e8542db07..498f6bb0adc11 100644
--- a/llvm/utils/lit/tests/shtest-shell.py
+++ b/llvm/utils/lit/tests/shtest-shell.py
@@ -1,7 +1,6 @@
 # Check the internal shell handling component of the ShTest format.
 
 # RUN: not %{lit} -v %{inputs}/shtest-shell > %t.out
-# RUN: cat %t.out > /tmp/test
 # RUN: FileCheck --input-file %t.out %s
 #
 # Test again in non-UTF shell to catch potential errors with python 2 seen



More information about the llvm-commits mailing list