[llvm] [z/OS] Modify regex in error message to match on z/OS. (PR #194020)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 08:49:20 PDT 2026


https://github.com/sujianIBM updated https://github.com/llvm/llvm-project/pull/194020

>From 4e854fd9131549818706d06d32257a0672b5d48d Mon Sep 17 00:00:00 2001
From: Jian Su <jian.su at ibm.com>
Date: Fri, 24 Apr 2026 18:47:59 +0000
Subject: [PATCH 1/7] Modify regex in error message to match on z/OS.

---
 llvm/utils/lit/tests/shtest-cat.py             | 2 +-
 llvm/utils/lit/tests/shtest-format.py          | 2 +-
 llvm/utils/lit/tests/shtest-output-printing.py | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py
index 9763f9fbf1a9d..7e9bb08706cda 100644
--- a/llvm/utils/lit/tests/shtest-cat.py
+++ b/llvm/utils/lit/tests/shtest-cat.py
@@ -13,7 +13,7 @@
 # CHECK: FAIL: shtest-cat :: cat-error-1.txt ({{[^)]*}})
 # CHECK: cat temp1.txt
 # CHECK: # .---command stderr{{-*}}
-# CHECK-NEXT: # | [Errno 2] No such file or directory: 'temp1.txt'
+# CHECK-NEXT: # | [Errno {{.*}}] {{.*}}No such file or directory{{.*}}: 'temp1.txt'
 # CHECK: # error: command failed with exit status: 1
 
 # CHECK: PASS: shtest-cat :: cat.txt ({{[^)]*}})
diff --git a/llvm/utils/lit/tests/shtest-format.py b/llvm/utils/lit/tests/shtest-format.py
index fda3ef52e8043..d764cc7e00979 100644
--- a/llvm/utils/lit/tests/shtest-format.py
+++ b/llvm/utils/lit/tests/shtest-format.py
@@ -18,7 +18,7 @@
 # CHECK: Command Output (stderr):
 # CHECK-NEXT: --
 # CHECK-NOT: --
-# CHECK: cat{{(_64)?(\.exe)?}}: {{(cannot open does-not-exist|.*does-not-exist.*: No such file or directory)}}
+# CHECK: cat{{(_64)?(\.exe)?}}: {{(cannot open does-not-exist|.*does-not-exist.*: .*No such file or directory)}}
 # CHECK: --
 
 # CHECK: FAIL: shtest-format :: external_shell/fail_with_bad_encoding.txt
diff --git a/llvm/utils/lit/tests/shtest-output-printing.py b/llvm/utils/lit/tests/shtest-output-printing.py
index b9045c3fe520b..2484ff7fd1e1d 100644
--- a/llvm/utils/lit/tests/shtest-output-printing.py
+++ b/llvm/utils/lit/tests/shtest-output-printing.py
@@ -25,7 +25,7 @@
 #  CHECK-NEXT: not not wc missing-file &> [[FILE:.*]] || true
 #  CHECK-NEXT: # executed command: not not wc missing-file
 #  CHECK-NEXT: # .---redirected output from '[[FILE]]'
-#  CHECK-NEXT: # | {{.*}}wc: {{cannot open missing-file|missing-file.* No such file or directory}}
+#  CHECK-NEXT: # | {{.*}}wc: {{cannot open missing-file|.*missing-file.*: .*No such file or directory}}
 #  CHECK-NEXT: # `-----------------------------
 #  CHECK-NEXT: # note: command had no output on stdout or stderr
 #  CHECK-NEXT: # error: command failed with exit status: 1

>From ffd9f2b3f35c447d5aa964fe8a1fc43fffa5cb45 Mon Sep 17 00:00:00 2001
From: Jian Su <jian.su at ibm.com>
Date: Thu, 7 May 2026 13:53:40 +0000
Subject: [PATCH 2/7] Use %errc_ENOENT.

---
 llvm/utils/lit/tests/lit.cfg       | 2 ++
 llvm/utils/lit/tests/shtest-cat.py | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/lit/tests/lit.cfg b/llvm/utils/lit/tests/lit.cfg
index 8fa625a162401..d2e226d9f9a4b 100644
--- a/llvm/utils/lit/tests/lit.cfg
+++ b/llvm/utils/lit/tests/lit.cfg
@@ -147,3 +147,5 @@ test_bin = os.path.join(os.path.dirname(__file__), "Inputs", "fake-externals")
 config.environment["PATH"] = os.path.pathsep.join(
     (test_bin, config.environment["PATH"])
 )
+if llvm_config:
+    llvm_config.add_err_msg_substitutions()
diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py
index 7e9bb08706cda..578c2e77779e2 100644
--- a/llvm/utils/lit/tests/shtest-cat.py
+++ b/llvm/utils/lit/tests/shtest-cat.py
@@ -1,7 +1,7 @@
 ## Test the cat command.
 #
 # RUN: not %{lit} -v %{inputs}/shtest-cat \
-# RUN: | FileCheck -match-full-lines %s
+# RUN: | FileCheck -match-full-lines -DMSG=%errc_ENOENT %s
 # END.
 
 # CHECK: FAIL: shtest-cat :: cat-error-0.txt ({{[^)]*}})
@@ -13,7 +13,7 @@
 # CHECK: FAIL: shtest-cat :: cat-error-1.txt ({{[^)]*}})
 # CHECK: cat temp1.txt
 # CHECK: # .---command stderr{{-*}}
-# CHECK-NEXT: # | [Errno {{.*}}] {{.*}}No such file or directory{{.*}}: 'temp1.txt'
+# CHECK-NEXT: # | [Errno {{.*}}] [[MSG]]: 'temp1.txt'
 # CHECK: # error: command failed with exit status: 1
 
 # CHECK: PASS: shtest-cat :: cat.txt ({{[^)]*}})

>From e29027b375b4d998e89c0cfe28fa0024404988b4 Mon Sep 17 00:00:00 2001
From: Jian Su <jian.su at ibm.com>
Date: Thu, 7 May 2026 18:30:48 +0000
Subject: [PATCH 3/7] Add a feature llvm_config_available.

---
 llvm/utils/lit/tests/lit.cfg       | 4 ++--
 llvm/utils/lit/tests/shtest-cat.py | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/lit/tests/lit.cfg b/llvm/utils/lit/tests/lit.cfg
index d2e226d9f9a4b..bdafc5c1e195c 100644
--- a/llvm/utils/lit/tests/lit.cfg
+++ b/llvm/utils/lit/tests/lit.cfg
@@ -44,6 +44,8 @@ lit_path = os.path.abspath(lit_path)
 # Required because some tests import the lit module
 if llvm_config:
     llvm_config.with_environment("PYTHONPATH", lit_path, append_path=True)
+    config.available_features.add("llvm_config_available")
+    llvm_config.add_err_msg_substitutions()
 else:
     config.environment["PYTHONPATH"] = lit_path
 # Do not add user-site packages directory to the python search path. This avoids test failures if there's an
@@ -147,5 +149,3 @@ test_bin = os.path.join(os.path.dirname(__file__), "Inputs", "fake-externals")
 config.environment["PATH"] = os.path.pathsep.join(
     (test_bin, config.environment["PATH"])
 )
-if llvm_config:
-    llvm_config.add_err_msg_substitutions()
diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py
index 578c2e77779e2..57dd8b5c1b359 100644
--- a/llvm/utils/lit/tests/shtest-cat.py
+++ b/llvm/utils/lit/tests/shtest-cat.py
@@ -1,4 +1,7 @@
 ## Test the cat command.
+
+# This is required for the use of %errc_ENOENT.
+# REQUIRES: llvm_config_available
 #
 # RUN: not %{lit} -v %{inputs}/shtest-cat \
 # RUN: | FileCheck -match-full-lines -DMSG=%errc_ENOENT %s

>From 4d5656582c8f5809a8271cf8060294454326cb06 Mon Sep 17 00:00:00 2001
From: Jian Su <jian.su at ibm.com>
Date: Thu, 7 May 2026 19:09:42 +0000
Subject: [PATCH 4/7] Change the format of the feature name.

---
 llvm/utils/lit/tests/lit.cfg       | 2 +-
 llvm/utils/lit/tests/shtest-cat.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/lit/tests/lit.cfg b/llvm/utils/lit/tests/lit.cfg
index bdafc5c1e195c..76550c683f535 100644
--- a/llvm/utils/lit/tests/lit.cfg
+++ b/llvm/utils/lit/tests/lit.cfg
@@ -44,7 +44,7 @@ lit_path = os.path.abspath(lit_path)
 # Required because some tests import the lit module
 if llvm_config:
     llvm_config.with_environment("PYTHONPATH", lit_path, append_path=True)
-    config.available_features.add("llvm_config_available")
+    config.available_features.add("llvm-config-available")
     llvm_config.add_err_msg_substitutions()
 else:
     config.environment["PYTHONPATH"] = lit_path
diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py
index 57dd8b5c1b359..d417d53eda35b 100644
--- a/llvm/utils/lit/tests/shtest-cat.py
+++ b/llvm/utils/lit/tests/shtest-cat.py
@@ -1,7 +1,7 @@
 ## Test the cat command.
 
 # This is required for the use of %errc_ENOENT.
-# REQUIRES: llvm_config_available
+# REQUIRES: llvm-config-available
 #
 # RUN: not %{lit} -v %{inputs}/shtest-cat \
 # RUN: | FileCheck -match-full-lines -DMSG=%errc_ENOENT %s

>From 1ce7daad43f7050af8da2e270fb3ae00b698504d Mon Sep 17 00:00:00 2001
From: Jian Su <jian.su at ibm.com>
Date: Thu, 7 May 2026 20:11:19 +0000
Subject: [PATCH 5/7] Use ERROR_MSG instead of MSG.

---
 llvm/utils/lit/tests/shtest-cat.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py
index d417d53eda35b..0ec0a122150dd 100644
--- a/llvm/utils/lit/tests/shtest-cat.py
+++ b/llvm/utils/lit/tests/shtest-cat.py
@@ -4,7 +4,7 @@
 # REQUIRES: llvm-config-available
 #
 # RUN: not %{lit} -v %{inputs}/shtest-cat \
-# RUN: | FileCheck -match-full-lines -DMSG=%errc_ENOENT %s
+# RUN: | FileCheck -match-full-lines -DERROR_MSG=%errc_ENOENT %s
 # END.
 
 # CHECK: FAIL: shtest-cat :: cat-error-0.txt ({{[^)]*}})
@@ -16,7 +16,7 @@
 # CHECK: FAIL: shtest-cat :: cat-error-1.txt ({{[^)]*}})
 # CHECK: cat temp1.txt
 # CHECK: # .---command stderr{{-*}}
-# CHECK-NEXT: # | [Errno {{.*}}] [[MSG]]: 'temp1.txt'
+# CHECK-NEXT: # | [Errno {{[0-9]+}}] [[ERROR_MSG]]: 'temp1.txt'
 # CHECK: # error: command failed with exit status: 1
 
 # CHECK: PASS: shtest-cat :: cat.txt ({{[^)]*}})

>From 2a9d393d7adfbf30e0d4f90bfbdd29d33ebbede7 Mon Sep 17 00:00:00 2001
From: Jian Su <jian.su at ibm.com>
Date: Mon, 11 May 2026 16:01:01 +0000
Subject: [PATCH 6/7] Use %if in the RUN cmd to distinguish platforms.

---
 llvm/utils/lit/tests/shtest-format.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/llvm/utils/lit/tests/shtest-format.py b/llvm/utils/lit/tests/shtest-format.py
index d764cc7e00979..747c9bce65ce1 100644
--- a/llvm/utils/lit/tests/shtest-format.py
+++ b/llvm/utils/lit/tests/shtest-format.py
@@ -3,6 +3,9 @@
 # RUN: rm -f %t.xml
 # RUN: not %{lit} -v %{inputs}/shtest-format --xunit-xml-output %t.xml > %t.out
 # RUN: FileCheck < %t.out %s
+# RUN: FileCheck -DERROR_MSG=%errc_ENOENT < %t.out %s \
+# RUN:   %if system-aix %{ --check-prefix=AIX,CHECK %} \
+# RUN:   %else  %{ --check-prefix=NON-AIX,CHECK %}
 # RUN: FileCheck --check-prefix=XUNIT < %t.xml %s
 
 # END.
@@ -18,7 +21,8 @@
 # CHECK: Command Output (stderr):
 # CHECK-NEXT: --
 # CHECK-NOT: --
-# CHECK: cat{{(_64)?(\.exe)?}}: {{(cannot open does-not-exist|.*does-not-exist.*: .*No such file or directory)}}
+# AIX: cat{{(_64)?(\.exe)?}}: cannot open does-not-exist
+# NON-AIX: cat{{(_64)?(\.exe)?}}: {{.*does-not-exist.*}}: [[ERROR_MSG]]
 # CHECK: --
 
 # CHECK: FAIL: shtest-format :: external_shell/fail_with_bad_encoding.txt

>From 5ee1bbe1d21e88cff3148b35efcc8bb5ef6435d4 Mon Sep 17 00:00:00 2001
From: Jian Su <jian.su at ibm.com>
Date: Mon, 11 May 2026 16:03:17 +0000
Subject: [PATCH 7/7] Remove the original code.

---
 llvm/utils/lit/tests/shtest-format.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/llvm/utils/lit/tests/shtest-format.py b/llvm/utils/lit/tests/shtest-format.py
index 747c9bce65ce1..be54855e1d3eb 100644
--- a/llvm/utils/lit/tests/shtest-format.py
+++ b/llvm/utils/lit/tests/shtest-format.py
@@ -2,7 +2,6 @@
 
 # RUN: rm -f %t.xml
 # RUN: not %{lit} -v %{inputs}/shtest-format --xunit-xml-output %t.xml > %t.out
-# RUN: FileCheck < %t.out %s
 # RUN: FileCheck -DERROR_MSG=%errc_ENOENT < %t.out %s \
 # RUN:   %if system-aix %{ --check-prefix=AIX,CHECK %} \
 # RUN:   %else  %{ --check-prefix=NON-AIX,CHECK %}



More information about the llvm-commits mailing list