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

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 21:36:15 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-testing-tools

Author: Aiden Grossman (boomanaiden154)

<details>
<summary>Changes</summary>

These removes another test that otherwise needs a shell. This does
remove test coverage for pipefail in the external shell, but the
external shell should be disabled by default pretty soon. This also adds
test coverage for the internal shell which did not exist before.


---
Full diff: https://github.com/llvm/llvm-project/pull/157223.diff


3 Files Affected:

- (removed) llvm/test/Other/pipefail.txt (-2) 
- (added) llvm/utils/lit/tests/Inputs/shtest-shell/pipefail.txt (+4) 
- (modified) llvm/utils/lit/tests/shtest-shell.py (+7-1) 


``````````diff
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)

``````````

</details>


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


More information about the llvm-commits mailing list