[llvm] [lit] Move pipefail test into lit tests (PR #157223)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 5 21:35:39 PDT 2025
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/157223
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.
>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] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=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)
More information about the llvm-commits
mailing list