[llvm] 48f20c8 - [z/OS] Modify regex in error message to match on z/OS. (#194020)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 4 06:16:45 PDT 2026
Author: sujianIBM
Date: 2026-06-04T09:16:39-04:00
New Revision: 48f20c86d0fe594bdb3a5633cb11e19829211ec4
URL: https://github.com/llvm/llvm-project/commit/48f20c86d0fe594bdb3a5633cb11e19829211ec4
DIFF: https://github.com/llvm/llvm-project/commit/48f20c86d0fe594bdb3a5633cb11e19829211ec4.diff
LOG: [z/OS] Modify regex in error message to match on z/OS. (#194020)
This PR modifies regex in error message to match on z/OS:
```
[Errno 129] EDC5129I No such file or directory.: 'temp1.txt'
wc: file "missing-file": EDC5129I No such file or directory.
cat: does-not-exist: EDC5129I No such file or directory.
```
Added:
Modified:
llvm/utils/lit/tests/lit.cfg
llvm/utils/lit/tests/shtest-cat.py
llvm/utils/lit/tests/shtest-format.py
llvm/utils/lit/tests/shtest-output-printing.py
Removed:
################################################################################
diff --git a/llvm/utils/lit/tests/lit.cfg b/llvm/utils/lit/tests/lit.cfg
index 8fa625a162401..76550c683f535 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
diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py
index 9763f9fbf1a9d..db7259b1c7d6e 100644
--- a/llvm/utils/lit/tests/shtest-cat.py
+++ b/llvm/utils/lit/tests/shtest-cat.py
@@ -1,7 +1,10 @@
## 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 %s
+# RUN: | FileCheck -match-full-lines -DERROR_MSG=%errc_ENOENT %s
# END.
# CHECK: FAIL: shtest-cat :: cat-error-0.txt ({{[^)]*}})
@@ -13,7 +16,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 {{[0-9]+}}] [[ERROR_MSG]]: '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..7819cae4d7dd1 100644
--- a/llvm/utils/lit/tests/shtest-format.py
+++ b/llvm/utils/lit/tests/shtest-format.py
@@ -1,8 +1,13 @@
# Check the various features of the ShTest format.
+## This is required for the use of %errc_ENOENT.
+# REQUIRES: llvm-config-available
+
# 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 +23,11 @@
# 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 needs the regex because alternative versions of cat generate
diff erent
+## formats of error message. %errc_ENOENT can't be used here because [[...]]
+## inside {{...}} is not supported.
+# AIX: cat{{(_64)?(\.exe)?}}: {{(cannot open does-not-exist|.*does-not-exist.*: No such file or directory)}}
+# NON-AIX: cat{{(_64)?(\.exe)?}}: {{.*does-not-exist.*}}: [[ERROR_MSG]]
# 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..4565c66e7903c 100644
--- a/llvm/utils/lit/tests/shtest-output-printing.py
+++ b/llvm/utils/lit/tests/shtest-output-printing.py
@@ -1,7 +1,12 @@
-# Check the various features of the ShTest format.
+## Check the various features of the ShTest format.
+#
+## This is required for the use of %errc_ENOENT.
+# REQUIRES: llvm-config-available
#
# RUN: not %{lit} -v %{inputs}/shtest-output-printing > %t.out
-# RUN: FileCheck --input-file %t.out --match-full-lines %s
+# RUN: FileCheck --input-file %t.out --match-full-lines -DERROR_MSG=%errc_ENOENT %s \
+# RUN: %if system-aix %{ --check-prefix=AIX,CHECK %} \
+# RUN: %else %{ --check-prefix=NON-AIX,CHECK %}
#
# END.
@@ -25,7 +30,11 @@
# 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}}
+## AIX needs the regex because alternative versions of wc generate
diff erent
+## formats of error message. %errc_ENOENT can't be used here because [[...]]
+## inside {{...}} is not supported.
+# AIX-NEXT: # | {{.*}}wc: {{cannot open missing-file|missing-file.* No such file or directory}}
+# NON-AIX-NEXT: # | {{.*}}wc: {{.*missing-file.*}}: [[ERROR_MSG]]
# CHECK-NEXT: # `-----------------------------
# CHECK-NEXT: # note: command had no output on stdout or stderr
# CHECK-NEXT: # error: command failed with exit status: 1
More information about the llvm-commits
mailing list