[lld] 42a2177 - [test] Use host platform specific error message substitution in lit tests
Abhina Sreeskantharajan via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 29 04:16:41 PST 2021
Author: Abhina Sreeskantharajan
Date: 2021-01-29T07:16:30-05:00
New Revision: 42a21778f61cdc8462ce2cfb6ad7bc1992b2063c
URL: https://github.com/llvm/llvm-project/commit/42a21778f61cdc8462ce2cfb6ad7bc1992b2063c
DIFF: https://github.com/llvm/llvm-project/commit/42a21778f61cdc8462ce2cfb6ad7bc1992b2063c.diff
LOG: [test] Use host platform specific error message substitution in lit tests
On z/OS, the following error message is not matched correctly in lit tests.
```
EDC5129I No such file or directory.
```
This patch uses a lit config substitution to check for platform specific error messages.
Reviewed By: muiez, jhenderson
Differential Revision: https://reviews.llvm.org/D95246
Added:
Modified:
clang/test/CodeGen/basic-block-sections.c
clang/test/CodeGen/ubsan-blacklist-vfs.c
clang/test/Driver/clang-offload-bundler.c
clang/test/Frontend/output-paths.c
clang/test/Frontend/stats-file.c
lld/test/COFF/driver.test
lld/test/COFF/manifestinput-error.test
lld/test/COFF/nodefaultlib.test
lld/test/COFF/pdb-type-server-invalid-signature.yaml
lld/test/COFF/pdb-type-server-missing.yaml
lld/test/ELF/archive-thin-missing-member.s
lld/test/ELF/basic.s
lld/test/ELF/reproduce-error.s
lld/test/ELF/symbol-ordering-file.s
lld/test/MachO/invalid/no-filelist.s
llvm/docs/TestingGuide.rst
llvm/test/DebugInfo/symbolize-missing-file.test
llvm/test/MC/Hexagon/not_found.s
llvm/test/Object/archive-extract-dir.test
llvm/test/Object/archive-extract.test
llvm/test/Object/directory.ll
llvm/test/tools/dsymutil/X86/papertrail-warnings.test
llvm/test/tools/dsymutil/archive-timestamp.test
llvm/test/tools/dsymutil/debug-map-parsing.test
llvm/test/tools/llvm-ar/error-opening-directory.test
llvm/test/tools/llvm-ar/missing-thin-archive-member.test
llvm/test/tools/llvm-ar/move.test
llvm/test/tools/llvm-ar/print.test
llvm/test/tools/llvm-ar/quick-append.test
llvm/test/tools/llvm-ar/replace.test
llvm/test/tools/llvm-ar/response.test
llvm/test/tools/llvm-cxxdump/trivial.test
llvm/test/tools/llvm-libtool-darwin/filelist.test
llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test
llvm/test/tools/llvm-lipo/create-arch.test
llvm/test/tools/llvm-lipo/replace-invalid-input.test
llvm/test/tools/llvm-lto/error.ll
llvm/test/tools/llvm-lto2/X86/stats-file-option.ll
llvm/test/tools/llvm-mc/basic.test
llvm/test/tools/llvm-mca/invalid_input_file_name.test
llvm/test/tools/llvm-ml/basic.test
llvm/test/tools/llvm-objcopy/COFF/add-section.test
llvm/test/tools/llvm-objcopy/ELF/add-section.test
llvm/test/tools/llvm-objcopy/ELF/error-format.test
llvm/test/tools/llvm-objcopy/MachO/add-section-error.test
llvm/test/tools/llvm-objcopy/redefine-symbols.test
llvm/test/tools/llvm-objcopy/wasm/dump-section.test
llvm/test/tools/llvm-profdata/weight-instr.test
llvm/test/tools/llvm-profdata/weight-sample.test
llvm/test/tools/llvm-readobj/ELF/thin-archive-paths.test
llvm/test/tools/llvm-readobj/basic.test
llvm/test/tools/llvm-readobj/thin-archive.test
llvm/test/tools/llvm-size/no-input.test
llvm/test/tools/llvm-symbolizer/pdb/missing_pdb.test
llvm/test/tools/llvm-xray/X86/no-such-file.txt
llvm/test/tools/obj2yaml/invalid_input_file.test
llvm/test/tools/yaml2obj/output-file.yaml
llvm/utils/lit/lit/llvm/config.py
Removed:
################################################################################
diff --git a/clang/test/CodeGen/basic-block-sections.c b/clang/test/CodeGen/basic-block-sections.c
index 70cdeeebb0d3..ee0dc90e2d02 100644
--- a/clang/test/CodeGen/basic-block-sections.c
+++ b/clang/test/CodeGen/basic-block-sections.c
@@ -7,7 +7,7 @@
// RUN: %clang_cc1 -triple x86_64 -S -fbasic-block-sections=list=%S/Inputs/basic-block-sections.funcnames -o - < %s | FileCheck %s --check-prefix=BB_WORLD --check-prefix=BB_LIST
// RUN: %clang_cc1 -triple x86_64 -S -fbasic-block-sections=all -funique-basic-block-section-names -o - < %s | FileCheck %s --check-prefix=UNIQUE
// RUN: rm -f %t
-// RUN: not %clang_cc1 -fbasic-block-sections=list= -emit-obj -o %t %s 2>&1 | FileCheck %s --check-prefix=ERROR
+// RUN: not %clang_cc1 -fbasic-block-sections=list= -emit-obj -o %t %s 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=ERROR
// RUN: not ls %t
int world(int a) {
@@ -41,4 +41,4 @@ int another(int a) {
//
// UNIQUE: .section .text.world.world.__part.1,
// UNIQUE: .section .text.another.another.__part.1,
-// ERROR: error: unable to load basic block sections function list: '{{[Nn]}}o such file or directory'
+// ERROR: error: unable to load basic block sections function list: '[[MSG]]'
diff --git a/clang/test/CodeGen/ubsan-blacklist-vfs.c b/clang/test/CodeGen/ubsan-blacklist-vfs.c
index 0647cbf7a57b..558c5f5ea817 100644
--- a/clang/test/CodeGen/ubsan-blacklist-vfs.c
+++ b/clang/test/CodeGen/ubsan-blacklist-vfs.c
@@ -7,11 +7,11 @@
// RUN: sed -e "s|@DIR@|%/T|g" %S/Inputs/sanitizer-blacklist-vfsoverlay.yaml | sed -e "s|@REAL_FILE@|%/t-func.blacklist|g" | sed -e "s|@NONEXISTENT_FILE@|%/t-nonexistent.blacklist|g" > %t-vfsoverlay.yaml
// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%/T/only-virtual-file.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
-// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%/T/invalid-virtual-file.blacklist -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE
-// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': {{[Nn]}}o such file or directory
+// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%/T/invalid-virtual-file.blacklist -emit-llvm %s -o - 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=INVALID-MAPPED-FILE
+// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': [[MSG]]
-// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%t-nonexistent.blacklist -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID
-// INVALID: nonexistent.blacklist': {{[Nn]}}o such file or directory
+// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%t-nonexistent.blacklist -emit-llvm %s -o - 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=INVALID
+// INVALID: nonexistent.blacklist': [[MSG]]
unsigned i;
diff --git a/clang/test/Driver/clang-offload-bundler.c b/clang/test/Driver/clang-offload-bundler.c
index 3e1fab25d754..32fe6dad1f3f 100644
--- a/clang/test/Driver/clang-offload-bundler.c
+++ b/clang/test/Driver/clang-offload-bundler.c
@@ -70,9 +70,11 @@
// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
// CK-ERR4: error: number of output files and targets should match in unbundling mode
-// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2.notexist -outputs=%t.bundle.i 2>&1 | FileCheck %s -DFILE=%t.tgt2.notexist --check-prefix CK-ERR5
-// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i.notexist -unbundle 2>&1 | FileCheck %s -DFILE=%t.bundle.i.notexist --check-prefix CK-ERR5
-// CK-ERR5: error: '[[FILE]]': {{N|n}}o such file or directory
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2.notexist -outputs=%t.bundle.i 2>&1 | \
+// RUN: FileCheck %s -DFILE=%t.tgt2.notexist -DMSG=%errc_ENOENT --check-prefix CK-ERR5
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i.notexist -unbundle 2>&1 | \
+// RUN: FileCheck %s -DFILE=%t.bundle.i.notexist -DMSG=%errc_ENOENT --check-prefix CK-ERR5
+// CK-ERR5: error: '[[FILE]]': [[MSG]]
// RUN: not clang-offload-bundler -type=invalid -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s -DTYPE=invalid --check-prefix CK-ERR6
// CK-ERR6: error: '[[TYPE]]': invalid file type specified
diff --git a/clang/test/Frontend/output-paths.c b/clang/test/Frontend/output-paths.c
index 0e9ea63f8067..5b0cbb4d77cc 100644
--- a/clang/test/Frontend/output-paths.c
+++ b/clang/test/Frontend/output-paths.c
@@ -1,4 +1,4 @@
// RUN: not %clang_cc1 -emit-llvm -o %t.doesnotexist/somename %s 2> %t
-// RUN: FileCheck -check-prefix=OUTPUTFAIL -input-file=%t %s
+// RUN: FileCheck -check-prefix=OUTPUTFAIL -DMSG=%errc_ENOENT -input-file=%t %s
-// OUTPUTFAIL: error: unable to open output file '{{.*}}doesnotexist{{.}}somename': '{{[nN]}}o such file or directory'
+// OUTPUTFAIL: error: unable to open output file '{{.*}}doesnotexist{{.}}somename': '[[MSG]]'
diff --git a/clang/test/Frontend/stats-file.c b/clang/test/Frontend/stats-file.c
index 53b264534c57..43aec05e8e5f 100644
--- a/clang/test/Frontend/stats-file.c
+++ b/clang/test/Frontend/stats-file.c
@@ -4,5 +4,5 @@
// ... here come some json values ...
// CHECK: }
-// RUN: %clang_cc1 -emit-llvm -o %t -stats-file=%t.doesnotexist/bla %s 2>&1 | FileCheck -check-prefix=OUTPUTFAIL %s
-// OUTPUTFAIL: warning: unable to open statistics output file '{{.*}}doesnotexist{{.}}bla': '{{[Nn]}}o such file or directory'
+// RUN: %clang_cc1 -emit-llvm -o %t -stats-file=%t.doesnotexist/bla %s 2>&1 | FileCheck -DMSG=%errc_ENOENT -check-prefix=OUTPUTFAIL %s
+// OUTPUTFAIL: warning: unable to open statistics output file '{{.*}}doesnotexist{{.}}bla': '[[MSG]]'
diff --git a/lld/test/COFF/driver.test b/lld/test/COFF/driver.test
index d756dc9ed4aa..363df6d8fb31 100644
--- a/lld/test/COFF/driver.test
+++ b/lld/test/COFF/driver.test
@@ -1,6 +1,6 @@
# RUN: not lld-link nosuchfile.obj >& %t.log
-# RUN: FileCheck -check-prefix=MISSING %s < %t.log
-MISSING: 'nosuchfile.obj': {{[Nn]}}o such file or directory
+# RUN: FileCheck -DMSG=%errc_ENOENT -check-prefix=MISSING %s < %t.log
+MISSING: 'nosuchfile.obj': [[MSG]]
# RUN: lld-link --version | FileCheck -check-prefix=VERSION %s
VERSION: {{LLD [0-9]+\.[0-9]+}}
diff --git a/lld/test/COFF/manifestinput-error.test b/lld/test/COFF/manifestinput-error.test
index ea61bae2f7c0..6bddf8825456 100644
--- a/lld/test/COFF/manifestinput-error.test
+++ b/lld/test/COFF/manifestinput-error.test
@@ -5,6 +5,6 @@
# RUN: env LLD_IN_TEST=1 not lld-link /out:%t.exe /entry:main \
# RUN: /manifest:embed \
# RUN: /manifestuac:"level='requireAdministrator'" \
-# RUN: /manifestinput:%p/Inputs/manifestinput.test %t.obj 2>&1 | FileCheck %s
+# RUN: /manifestinput:%p/Inputs/manifestinput.test %t.obj 2>&1 | FileCheck -DMSG=%errc_ENOENT %s
-# CHECK: error: unable to find mt.exe in PATH: {{[Nn]}}o such file or directory
+# CHECK: error: unable to find mt.exe in PATH: [[MSG]]
diff --git a/lld/test/COFF/nodefaultlib.test b/lld/test/COFF/nodefaultlib.test
index 61a31c21b6cc..ca8f09bdfc76 100644
--- a/lld/test/COFF/nodefaultlib.test
+++ b/lld/test/COFF/nodefaultlib.test
@@ -3,11 +3,11 @@
# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console \
# RUN: hello64.obj /defaultlib:std64.lib >& %t.log
-# RUN: FileCheck -check-prefix=CHECK1 %s < %t.log
+# RUN: FileCheck -DMSG=%errc_ENOENT -check-prefix=CHECK1 %s < %t.log
# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console \
# RUN: hello64 /defaultlib:std64.lib >& %t.log
-# RUN: FileCheck -check-prefix=CHECK2 %s < %t.log
+# RUN: FileCheck -DMSG=%errc_ENOENT -check-prefix=CHECK2 %s < %t.log
# RUN: lld-link /libpath:%T /out:%t.exe /entry:main \
# RUN: /subsystem:console hello64.obj /defaultlib:std64.lib \
@@ -19,8 +19,8 @@
# RUN: /nodefaultlib:std64.lib >& %t.log || true
# RUN: FileCheck -check-prefix=CHECK3 %s < %t.log
-CHECK1: error: could not open 'hello64.obj': {{[Nn]}}o such file or directory
-CHECK2: error: could not open 'hello64': {{[Nn]}}o such file or directory
+CHECK1: error: could not open 'hello64.obj': [[MSG]]
+CHECK2: error: could not open 'hello64': [[MSG]]
CHECK3: error: undefined symbol: MessageBoxA
CHECK3-NEXT: >>> referenced by {{.*}}hello64.obj:(main)
diff --git a/lld/test/COFF/pdb-type-server-invalid-signature.yaml b/lld/test/COFF/pdb-type-server-invalid-signature.yaml
index 612bd74eeaa8..de8cb46b2ddc 100644
--- a/lld/test/COFF/pdb-type-server-invalid-signature.yaml
+++ b/lld/test/COFF/pdb-type-server-invalid-signature.yaml
@@ -20,10 +20,10 @@
# Test an invalid path reference to a PDB type server; as a fallback LLD should try to load the PDB in the same path as the OBJ
# RUN: yaml2obj %S/Inputs/pdb-type-server-invalid-path.yaml -o %t3.obj
# RUN: cp %S/Inputs/pdb-
diff -cl.pdb %T
-# RUN: lld-link %t3.obj -out:%t3.exe -debug -pdb:%t3.pdb -nodefaultlib -entry:main 2>&1 | FileCheck %s -check-prefix=INVALID-PATH -allow-empty
+# RUN: lld-link %t3.obj -out:%t3.exe -debug -pdb:%t3.pdb -nodefaultlib -entry:main 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID-PATH -allow-empty
# INVALID-PATH-NOT: warning: Cannot use debug info for '{{.*}}3.obj' [LNK4099]
-# INVALID-PATH-NOT: failed to load reference 'c:\some_invalid_path_AABB98765\pdb-
diff -cl.pdb': {{[Nn]}}o such file or directory
+# INVALID-PATH-NOT: failed to load reference 'c:\some_invalid_path_AABB98765\pdb-
diff -cl.pdb': [[MSG]]
--- !COFF
header:
diff --git a/lld/test/COFF/pdb-type-server-missing.yaml b/lld/test/COFF/pdb-type-server-missing.yaml
index 78ddc0e4adb2..70e638b28b51 100644
--- a/lld/test/COFF/pdb-type-server-missing.yaml
+++ b/lld/test/COFF/pdb-type-server-missing.yaml
@@ -4,23 +4,23 @@
# RUN: yaml2obj %s -o %t1.obj
# RUN: yaml2obj %p/Inputs/pdb-type-server-missing-2.yaml -o %t2.obj
-# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main 2>&1 | FileCheck %s -check-prefix=WARN
-# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug:ghash -pdb:%t.pdb -nodefaultlib -entry:main 2>&1 | FileCheck %s -check-prefix=WARN
-# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /ignore:4099 2>&1 | FileCheck %s -check-prefix=IGNORE -allow-empty
-# RUN: not lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /WX 2>&1 | FileCheck %s -check-prefix=ERR
-# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /ignore:4099 /WX 2>&1 | FileCheck %s -check-prefix=IGNORE-ERR -allow-empty
+# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=WARN
+# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug:ghash -pdb:%t.pdb -nodefaultlib -entry:main 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=WARN
+# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /ignore:4099 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=IGNORE -allow-empty
+# RUN: not lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /WX 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=ERR
+# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /ignore:4099 /WX 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=IGNORE-ERR -allow-empty
# WARN: warning: Cannot use debug info for '{{.*}}.obj' [LNK4099]
-# WARN-NEXT: {{N|n}}o such file or directory
+# WARN-NEXT: [[MSG]]
# IGNORE-NOT: warning: Cannot use debug info for '{{.*}}.obj' [LNK4099]
-# IGNORE-NOT: {{N|n}}o such file or directory
+# IGNORE-NOT: [[MSG]]
# ERR: error: Cannot use debug info for '{{.*}}.obj' [LNK4099]
-# ERR-NEXT: {{N|n}}o such file or directory
+# ERR-NEXT: [[MSG]]
# IGNORE-ERR-NOT: error: Cannot use debug info for '{{.*}}.obj' [LNK4099]
-# IGNORE-ERR-NOT: {{N|n}}o such file or directory
+# IGNORE-ERR-NOT: [[MSG]]
--- !COFF
header:
diff --git a/lld/test/ELF/archive-thin-missing-member.s b/lld/test/ELF/archive-thin-missing-member.s
index 4db1376cfaf2..473ebe9c9b6e 100644
--- a/lld/test/ELF/archive-thin-missing-member.s
+++ b/lld/test/ELF/archive-thin-missing-member.s
@@ -8,18 +8,18 @@
# RUN: rm %t.o
# Test error when loading symbols from missing thin archive member.
-# RUN: not ld.lld --entry=_Z1fi %t-no-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR1
-# ERR1: {{.*}}-no-syms.a: could not get the buffer for a child of the archive: '{{.*}}.o': {{[Nn]}}o such file or directory
+# RUN: not ld.lld --entry=_Z1fi %t-no-syms.a -o /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=ERR1
+# ERR1: {{.*}}-no-syms.a: could not get the buffer for a child of the archive: '{{.*}}.o': [[MSG]]
# Test error when thin archive has symbol table but member is missing.
-# RUN: not ld.lld --entry=_Z1fi -m elf_amd64_fbsd %t-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR2
-# ERR2: {{.*}}-syms.a: could not get the buffer for the member defining symbol f(int): '{{.*}}.o': {{[Nn]}}o such file or directory
-# RUN: not ld.lld --entry=_Z1fi --no-demangle -m elf_amd64_fbsd %t-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR2MANGLE
-# ERR2MANGLE: {{.*}}-syms.a: could not get the buffer for the member defining symbol _Z1fi: '{{.*}}.o': {{[Nn]}}o such file or directory
+# RUN: not ld.lld --entry=_Z1fi -m elf_amd64_fbsd %t-syms.a -o /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=ERR2
+# ERR2: {{.*}}-syms.a: could not get the buffer for the member defining symbol f(int): '{{.*}}.o': [[MSG]]
+# RUN: not ld.lld --entry=_Z1fi --no-demangle -m elf_amd64_fbsd %t-syms.a -o /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=ERR2MANGLE
+# ERR2MANGLE: {{.*}}-syms.a: could not get the buffer for the member defining symbol _Z1fi: '{{.*}}.o': [[MSG]]
# Test error when thin archive is linked using --whole-archive but member is missing.
-# RUN: not ld.lld --entry=_Z1fi --whole-archive %t-syms.a -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR3
-# ERR3: {{.*}}-syms.a: could not get the buffer for a child of the archive: '{{.*}}.o': {{[Nn]}}o such file or directory
+# RUN: not ld.lld --entry=_Z1fi --whole-archive %t-syms.a -o /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=ERR3
+# ERR3: {{.*}}-syms.a: could not get the buffer for a child of the archive: '{{.*}}.o': [[MSG]]
.global _Z1fi
_Z1fi:
diff --git a/lld/test/ELF/basic.s b/lld/test/ELF/basic.s
index f6954b143493..6b17bf75ee7b 100644
--- a/lld/test/ELF/basic.s
+++ b/lld/test/ELF/basic.s
@@ -219,16 +219,16 @@ _start:
# INVRSP: invalid response file quoting: patatino
# RUN: not ld.lld %t.foo -o /dev/null 2>&1 | \
-# RUN: FileCheck --check-prefix=MISSING %s
-# MISSING: cannot open {{.*}}.foo: {{[Nn]}}o such file or directory
+# RUN: FileCheck -DMSG=%errc_ENOENT --check-prefix=MISSING %s
+# MISSING: cannot open {{.*}}.foo: [[MSG]]
# RUN: not ld.lld -o /dev/null 2>&1 | \
# RUN: FileCheck --check-prefix=NO_INPUT %s
# NO_INPUT: ld.lld{{.*}}: no input files
# RUN: not ld.lld %t.no.such.file -o /dev/null 2>&1 | \
-# RUN: FileCheck --check-prefix=CANNOT_OPEN %s
-# CANNOT_OPEN: cannot open {{.*}}.no.such.file: {{[Nn]}}o such file or directory
+# RUN: FileCheck -DMSG=%errc_ENOENT --check-prefix=CANNOT_OPEN %s
+# CANNOT_OPEN: cannot open {{.*}}.no.such.file: [[MSG]]
# RUN: not ld.lld --foo 2>&1 | FileCheck --check-prefix=UNKNOWN %s
# UNKNOWN: unknown argument '--foo'
diff --git a/lld/test/ELF/reproduce-error.s b/lld/test/ELF/reproduce-error.s
index 9fdb8790efe9..862b13970644 100644
--- a/lld/test/ELF/reproduce-error.s
+++ b/lld/test/ELF/reproduce-error.s
@@ -2,8 +2,8 @@
# RUN: mkdir -p %t.dir
# RUN: cd %t.dir
-# RUN: not ld.lld --reproduce repro.tar abc -o t 2>&1 | FileCheck %s
-# CHECK: cannot open abc: {{N|n}}o such file or directory
+# RUN: not ld.lld --reproduce repro.tar abc -o t 2>&1 | FileCheck -DMSG=%errc_ENOENT %s
+# CHECK: cannot open abc: [[MSG]]
# RUN: tar xOf repro.tar repro/response.txt | FileCheck --check-prefix=RSP %s
# RSP: abc
diff --git a/lld/test/ELF/symbol-ordering-file.s b/lld/test/ELF/symbol-ordering-file.s
index f6776cdb6f67..8ed35738ad56 100644
--- a/lld/test/ELF/symbol-ordering-file.s
+++ b/lld/test/ELF/symbol-ordering-file.s
@@ -41,9 +41,9 @@
## Show that a nonexistent symbol ordering file causes an error.
# RUN: not ld.lld --symbol-ordering-file=%t.nonexistent %t.o -o %t3.out 2>&1 | \
-# RUN: FileCheck %s --check-prefix=ERR -DFILE=%t.nonexistent
+# RUN: FileCheck -DMSG=%errc_ENOENT %s --check-prefix=ERR -DFILE=%t.nonexistent
-# ERR: error: cannot open [[FILE]]: {{[Nn]}}o such file or directory
+# ERR: error: cannot open [[FILE]]: [[MSG]]
## Show that an empty ordering file can be handled (symbols remain in their
## normal order).
diff --git a/lld/test/MachO/invalid/no-filelist.s b/lld/test/MachO/invalid/no-filelist.s
index 47e8f33fde04..99324b7552b3 100644
--- a/lld/test/MachO/invalid/no-filelist.s
+++ b/lld/test/MachO/invalid/no-filelist.s
@@ -1,7 +1,7 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
-# RUN: not %lld -filelist nonexistent %t.o -o %t 2>&1 | FileCheck %s
-# CHECK: cannot open nonexistent: {{N|n}}o such file or directory
+# RUN: not %lld -filelist nonexistent %t.o -o %t 2>&1 | FileCheck -DMSG=%errc_ENOENT %s
+# CHECK: cannot open nonexistent: [[MSG]]
.globl _main
diff --git a/llvm/docs/TestingGuide.rst b/llvm/docs/TestingGuide.rst
index 2070e3842761..d87b8d50d453 100644
--- a/llvm/docs/TestingGuide.rst
+++ b/llvm/docs/TestingGuide.rst
@@ -537,6 +537,16 @@ RUN lines:
Example: ``%:s: C\Desktop Files\foo_test.s.tmp``
+``%errc_<ERRCODE>``
+
+ Some error messages may be substituted to allow
diff erent spellings
+ based on the host platform.
+
+ The following error codes are currently supported: ENOENT, EISDIR.
+
+ Example: ``Linux %errc_ENOENT: No such file or directory``
+
+ Example: ``Windows %errc_ENOENT: no such file or directory``
**LLVM-specific substitutions:**
diff --git a/llvm/test/DebugInfo/symbolize-missing-file.test b/llvm/test/DebugInfo/symbolize-missing-file.test
index 2762af4ff5da..790428915d53 100644
--- a/llvm/test/DebugInfo/symbolize-missing-file.test
+++ b/llvm/test/DebugInfo/symbolize-missing-file.test
@@ -1,3 +1,3 @@
-RUN: llvm-symbolizer --obj=unexisting-file 0x1234 2>&1 | FileCheck %s
+RUN: llvm-symbolizer --obj=unexisting-file 0x1234 2>&1 | FileCheck -DMSG=%errc_ENOENT %s
-CHECK: LLVMSymbolizer: error reading file: {{[Nn]}}o such file or directory
+CHECK: LLVMSymbolizer: error reading file: [[MSG]]
diff --git a/llvm/test/MC/Hexagon/not_found.s b/llvm/test/MC/Hexagon/not_found.s
index 2403042792dd..9f1ba4d76e5d 100644
--- a/llvm/test/MC/Hexagon/not_found.s
+++ b/llvm/test/MC/Hexagon/not_found.s
@@ -1,4 +1,4 @@
-# RUN: not llvm-mc -arch=hexagon -filetype=asm junk123.s 2>%t ; FileCheck %s < %t
+# RUN: not llvm-mc -arch=hexagon -filetype=asm junk123.s 2>%t ; FileCheck -DMSG=%errc_ENOENT %s < %t
#
-# CHECK: junk123.s: {{[N|n]}}o such file or directory
+# CHECK: junk123.s: [[MSG]]
diff --git a/llvm/test/Object/archive-extract-dir.test b/llvm/test/Object/archive-extract-dir.test
index 5182a2f91411..67d6781ee092 100644
--- a/llvm/test/Object/archive-extract-dir.test
+++ b/llvm/test/Object/archive-extract-dir.test
@@ -6,6 +6,6 @@ RUN: rm -f test.a
RUN: llvm-ar rc test.a foo
RUN: rm foo
RUN: mkdir foo
-RUN: not llvm-ar x test.a foo 2>&1 | FileCheck %s
+RUN: not llvm-ar x test.a foo 2>&1 | FileCheck -DMSG=%errc_EISDIR %s
-CHECK: foo: {{[Ii]}}s a directory
+CHECK: foo: [[MSG]]
diff --git a/llvm/test/Object/archive-extract.test b/llvm/test/Object/archive-extract.test
index 11ca12e3353b..57b3c8f6795a 100644
--- a/llvm/test/Object/archive-extract.test
+++ b/llvm/test/Object/archive-extract.test
@@ -57,5 +57,5 @@ THINEXTRACT: extracting from a thin archive is not supported
RUN: llvm-ar p %p/Inputs/thin.a evenlen | FileCheck %s --check-prefix=EVENLEN
EVENLEN: evenlen
-RUN: not llvm-ar p %p/Inputs/thin-path.a t/test2.o 2>&1 | FileCheck %s --check-prefix=MISSING
-MISSING: error: {{N|n}}o such file or directory
+RUN: not llvm-ar p %p/Inputs/thin-path.a t/test2.o 2>&1 | FileCheck %s --DMSG=%errc_ENOENT --check-prefix=MISSING
+MISSING: error: [[MSG]]
diff --git a/llvm/test/Object/directory.ll b/llvm/test/Object/directory.ll
index 3e9ac2ce202e..b9da6b7ffb7a 100644
--- a/llvm/test/Object/directory.ll
+++ b/llvm/test/Object/directory.ll
@@ -1,6 +1,6 @@
;RUN: rm -rf %t && mkdir -p %t
-;RUN: not llvm-ar r %t/test.a . 2>&1 | FileCheck %s
-;CHECK: .: {{I|i}}s a directory
+;RUN: not llvm-ar r %t/test.a . 2>&1 | FileCheck -DMSG=%errc_EISDIR %s
+;CHECK: .: [[MSG]]
;RUN: rm -f %t/test.a
;RUN: touch %t/a-very-long-file-name
diff --git a/llvm/test/tools/dsymutil/X86/papertrail-warnings.test b/llvm/test/tools/dsymutil/X86/papertrail-warnings.test
index 1954994c9e1e..1678adb8ae7b 100644
--- a/llvm/test/tools/dsymutil/X86/papertrail-warnings.test
+++ b/llvm/test/tools/dsymutil/X86/papertrail-warnings.test
@@ -1,4 +1,4 @@
-RUN: env RC_DEBUG_OPTIONS=1 dsymutil -f %p/../Inputs/basic.macho.x86_64 -o - | llvm-dwarfdump -v - | FileCheck %s
+RUN: env RC_DEBUG_OPTIONS=1 dsymutil -f %p/../Inputs/basic.macho.x86_64 -o - | llvm-dwarfdump -v - | FileCheck -DMSG=%errc_ENOENT %s
CHECK: .debug_info contents:
CHECK: Compile Unit:
@@ -8,7 +8,7 @@ CHECK: DW_AT_name {{.*}}"/Inputs/basic1.macho.x86_64.o"
CHECK: DW_TAG_constant [2]
CHECK: DW_AT_name {{.*}}"dsymutil_warning"
CHECK: DW_AT_artificial [DW_FORM_flag] (0x01)
-CHECK: DW_AT_const_value {{.*}}"unable to open object file: {{[Nn]}}o such file or directory"
+CHECK: DW_AT_const_value {{.*}}"unable to open object file: [[MSG]]"
CHECK: NULL
CHECK: Compile Unit:
CHECK: DW_TAG_compile_unit [1] *
@@ -17,7 +17,7 @@ CHECK: DW_AT_name {{.*}}"/Inputs/basic2.macho.x86_64.o"
CHECK: DW_TAG_constant [2]
CHECK: DW_AT_name {{.*}}"dsymutil_warning"
CHECK: DW_AT_artificial [DW_FORM_flag] (0x01)
-CHECK: DW_AT_const_value {{.*}}"unable to open object file: {{[Nn]}}o such file or directory"
+CHECK: DW_AT_const_value {{.*}}"unable to open object file: [[MSG]]"
CHECK: NULL
CHECK: Compile Unit:
CHECK: DW_TAG_compile_unit [1] *
@@ -26,5 +26,5 @@ CHECK: DW_AT_name {{.*}}"/Inputs/basic3.macho.x86_64.o"
CHECK: DW_TAG_constant [2]
CHECK: DW_AT_name {{.*}}"dsymutil_warning"
CHECK: DW_AT_artificial [DW_FORM_flag] (0x01)
-CHECK: DW_AT_const_value {{.*}}"unable to open object file: {{[Nn]}}o such file or directory"
+CHECK: DW_AT_const_value {{.*}}"unable to open object file: [[MSG]]"
CHECK: NULL
diff --git a/llvm/test/tools/dsymutil/archive-timestamp.test b/llvm/test/tools/dsymutil/archive-timestamp.test
index f8575442b31a..69fa261d59c8 100644
--- a/llvm/test/tools/dsymutil/archive-timestamp.test
+++ b/llvm/test/tools/dsymutil/archive-timestamp.test
@@ -1,9 +1,9 @@
-# RUN: dsymutil -no-output -oso-prepend-path=%p -y %s 2>&1 | FileCheck %s
+# RUN: dsymutil -no-output -oso-prepend-path=%p -y %s 2>&1 | FileCheck -DMSG=%errc_ENOENT %s
# This is the archive member part of basic-archive.macho.x86_64 debug map with corrupted timestamps.
-# CHECK: warning: {{.*}}libbasic.a(basic2.macho.x86_64.o): {{[Nn]o}} such file
-# CHECK: warning: {{.*}}libbasic.a(basic3.macho.x86_64.o): {{[Nn]o}} such file
+# CHECK: warning: {{.*}}libbasic.a(basic2.macho.x86_64.o): [[MSG]]
+# CHECK: warning: {{.*}}libbasic.a(basic3.macho.x86_64.o): [[MSG]]
---
triple: 'x86_64-apple-darwin'
diff --git a/llvm/test/tools/dsymutil/debug-map-parsing.test b/llvm/test/tools/dsymutil/debug-map-parsing.test
index a25e44598b30..2f2bf6a2d2c5 100644
--- a/llvm/test/tools/dsymutil/debug-map-parsing.test
+++ b/llvm/test/tools/dsymutil/debug-map-parsing.test
@@ -1,8 +1,8 @@
RUN: dsymutil -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 | FileCheck %s
RUN: dsymutil -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO
RUN: dsymutil -verbose -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic-archive.macho.x86_64 2>&1 | FileCheck %s --check-prefix=CHECK-ARCHIVE
-RUN: dsymutil -dump-debug-map %p/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefix=NOT-FOUND
-RUN: not dsymutil -dump-debug-map %p/Inputs/inexistant 2>&1 | FileCheck %s --check-prefix=NO-EXECUTABLE
+RUN: dsymutil -dump-debug-map %p/Inputs/basic.macho.x86_64 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=NOT-FOUND
+RUN: not dsymutil -dump-debug-map %p/Inputs/inexistant 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=NO-EXECUTABLE
Check that We can parse the debug map of the basic executable.
@@ -72,9 +72,9 @@ Check that we warn about missing object files (this presumes that the files aren
present in the machine's /Inputs/ folder, which should be a pretty safe bet).
warning: (x86_64) /Inputs/basic1.macho.x86_64.o unable to open object file:
-NOT-FOUND: warning: (x86_64) {{.*}}/Inputs/basic1.macho.x86_64.o unable to open object file: {{[Nn]o}} such file
-NOT-FOUND: warning: (x86_64) {{.*}}/Inputs/basic2.macho.x86_64.o unable to open object file: {{[Nn]o}} such file
-NOT-FOUND: warning: (x86_64) {{.*}}/Inputs/basic3.macho.x86_64.o unable to open object file: {{[Nn]o}} such file
+NOT-FOUND: warning: (x86_64) {{.*}}/Inputs/basic1.macho.x86_64.o unable to open object file: [[MSG]]
+NOT-FOUND: warning: (x86_64) {{.*}}/Inputs/basic2.macho.x86_64.o unable to open object file: [[MSG]]
+NOT-FOUND: warning: (x86_64) {{.*}}/Inputs/basic3.macho.x86_64.o unable to open object file: [[MSG]]
NOT-FOUND: ---
NOT-FOUND-NEXT: triple: 'x86_64-apple-darwin'
NOT-FOUND-NEXT: binary-path:{{.*}}/Inputs/basic.macho.x86_64
@@ -82,5 +82,5 @@ NOT-FOUND-NEXT: ...
Check that we correctly error out on invalid executable.
-NO-EXECUTABLE: cannot parse{{.*}}/inexistant': {{[Nn]o}} such file
+NO-EXECUTABLE: cannot parse{{.*}}/inexistant': [[MSG]]
NO-EXECUTABLE-NOT: ---
diff --git a/llvm/test/tools/llvm-ar/error-opening-directory.test b/llvm/test/tools/llvm-ar/error-opening-directory.test
index c3068871230f..a11600c2bb5a 100644
--- a/llvm/test/tools/llvm-ar/error-opening-directory.test
+++ b/llvm/test/tools/llvm-ar/error-opening-directory.test
@@ -7,6 +7,6 @@
## Passing in a directory:
# RUN: mkdir -p %t/tmpDir
# RUN: not llvm-ar p %t/tmpDir 2>&1 | \
-# RUN: FileCheck %s --check-prefix=IS-DIR -DARCHIVE=%t/tmpDir
+# RUN: FileCheck %s --check-prefix=IS-DIR -DARCHIVE=%t/tmpDir -DMSG=%errc_EISDIR
-# IS-DIR: error: unable to open '[[ARCHIVE]]': {{[iI]}}s a directory
+# IS-DIR: error: unable to open '[[ARCHIVE]]': [[MSG]]
diff --git a/llvm/test/tools/llvm-ar/missing-thin-archive-member.test b/llvm/test/tools/llvm-ar/missing-thin-archive-member.test
index c1d67cdce2f1..506ef38ff8d0 100644
--- a/llvm/test/tools/llvm-ar/missing-thin-archive-member.test
+++ b/llvm/test/tools/llvm-ar/missing-thin-archive-member.test
@@ -12,6 +12,6 @@
## File has been deleted.
# RUN: llvm-ar qT %t-archive.a %t-temp.txt
# RUN: rm %t-temp.txt
-# RUN: not llvm-ar p %t-archive.a 2>&1 | FileCheck %s --check-prefix=DELETED
+# RUN: not llvm-ar p %t-archive.a 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=DELETED
-# DELETED: error: {{[Nn]}}o such file or directory
+# DELETED: error: [[MSG]]
diff --git a/llvm/test/tools/llvm-ar/move.test b/llvm/test/tools/llvm-ar/move.test
index e62b8ccd609d..3ff8631e907e 100644
--- a/llvm/test/tools/llvm-ar/move.test
+++ b/llvm/test/tools/llvm-ar/move.test
@@ -82,9 +82,9 @@
## Member does not exist:
# RUN: llvm-ar rc %t/missing.a %t/1.o %t/2.o %t/3.o
# RUN: not llvm-ar m %t/missing.a %t/missing.txt 2>&1 \
-# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt
+# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt -DMSG=%errc_ENOENT
-# MISSING-FILE: error: [[FILE]]: {{[nN]}}o such file or directory
+# MISSING-FILE: error: [[FILE]]: [[MSG]]
--- !ELF
FileHeader:
diff --git a/llvm/test/tools/llvm-ar/print.test b/llvm/test/tools/llvm-ar/print.test
index 247a3d44022f..4c6d8fda9956 100644
--- a/llvm/test/tools/llvm-ar/print.test
+++ b/llvm/test/tools/llvm-ar/print.test
@@ -73,9 +73,9 @@
## Archive does not exist:
# RUN: not llvm-ar p %t/missing.a 2>&1 \
-# RUN: | FileCheck %s --check-prefix=MISSING-ARCHIVE -DARCHIVE=%t/missing.a
+# RUN: | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=MISSING-ARCHIVE -DARCHIVE=%t/missing.a
-# MISSING-ARCHIVE: error: unable to load '[[ARCHIVE]]': {{[nN]}}o such file or directory
+# MISSING-ARCHIVE: error: unable to load '[[ARCHIVE]]': [[MSG]]
## Member does not exist:
# RUN: not llvm-ar p %t/archive.a %t-missing.txt 2>&1 \
diff --git a/llvm/test/tools/llvm-ar/quick-append.test b/llvm/test/tools/llvm-ar/quick-append.test
index 968460ec88fa..60c3508a3da6 100644
--- a/llvm/test/tools/llvm-ar/quick-append.test
+++ b/llvm/test/tools/llvm-ar/quick-append.test
@@ -58,9 +58,9 @@
## Member does not exist:
# RUN: not llvm-ar qc %t/missing.a %t/missing.txt 2>&1 \
-# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt
+# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt -DMSG=%errc_ENOENT
-# MISSING-FILE: error: [[FILE]]: {{[nN]}}o such file or directory
+# MISSING-FILE: error: [[FILE]]: [[MSG]]
## Create and append members to a thin archive:
# RUN: llvm-ar qcT %t/thin-multiple.a %t/1.o
diff --git a/llvm/test/tools/llvm-ar/replace.test b/llvm/test/tools/llvm-ar/replace.test
index 389ac60270c4..4a6580abf124 100644
--- a/llvm/test/tools/llvm-ar/replace.test
+++ b/llvm/test/tools/llvm-ar/replace.test
@@ -89,9 +89,9 @@
## Member does not exist:
# RUN: llvm-ar rc %t/missing.a %t/1.o %t/2.o %t/3.o
# RUN: not llvm-ar r %t/missing.a %t/missing.txt 2>&1 \
-# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt
+# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt -DMSG=%errc_ENOENT
-# MISSING-FILE: error: [[FILE]]: {{[Nn]}}o such file or directory
+# MISSING-FILE: error: [[FILE]]: [[MSG]]
## Create and Replace member of thin archive:
# RUN: llvm-ar rcT %t/thin.a %t/1.o %t/2.o %t/3.o
diff --git a/llvm/test/tools/llvm-ar/response.test b/llvm/test/tools/llvm-ar/response.test
index d9262481172a..4e798c220103 100644
--- a/llvm/test/tools/llvm-ar/response.test
+++ b/llvm/test/tools/llvm-ar/response.test
@@ -33,9 +33,9 @@
# RUN: echo -e 'rc %/t.a blah\\foo' > %t-rsp.txt
# RUN: not llvm-ar --rsp-quoting=windows @%t-rsp.txt 2>&1 | \
-# RUN: FileCheck %s --check-prefix=WIN
-# WIN: error: blah\foo: {{[Nn]}}o such file or directory
+# RUN: FileCheck -DMSG=%errc_ENOENT %s --check-prefix=WIN
+# WIN: error: blah\foo: [[MSG]]
# RUN: not llvm-ar -rsp-quoting posix @%t-rsp.txt 2>&1 | \
-# RUN: FileCheck %s --check-prefix=POSIX
-# POSIX: error: blahfoo: {{[Nn]}}o such file or directory
+# RUN: FileCheck -DMSG=%errc_ENOENT %s --check-prefix=POSIX
+# POSIX: error: blahfoo: [[MSG]]
diff --git a/llvm/test/tools/llvm-cxxdump/trivial.test b/llvm/test/tools/llvm-cxxdump/trivial.test
index 8df0bc32e1e3..a7d8a2396197 100644
--- a/llvm/test/tools/llvm-cxxdump/trivial.test
+++ b/llvm/test/tools/llvm-cxxdump/trivial.test
@@ -62,5 +62,5 @@ ELF-I386-NEXT: _ZTV1A[8]: _ZN1A1fEv
MIXEDARCOFF-I386: ??_7S@@6B@[0]: ??_R4S@@6B@
-RUN: not llvm-cxxdump %t.blah 2>&1 | FileCheck --check-prefix=ENOENT %s
-ENOENT: {{.*}}.blah: error: {{[Nn]}}o such file or directory
+RUN: not llvm-cxxdump %t.blah 2>&1 | FileCheck -DMSG=%errc_ENOENT --check-prefix=ENOENT %s
+ENOENT: {{.*}}.blah: error: [[MSG]]
diff --git a/llvm/test/tools/llvm-libtool-darwin/filelist.test b/llvm/test/tools/llvm-libtool-darwin/filelist.test
index bb606f0585fa..b6e95383c467 100644
--- a/llvm/test/tools/llvm-libtool-darwin/filelist.test
+++ b/llvm/test/tools/llvm-libtool-darwin/filelist.test
@@ -63,25 +63,25 @@
## Check that an error is thrown when a file in the filelist doesn't exist in the cwd and no dirname is specified:
# RUN: echo 'no-such-file' > %t.invalid-list.txt
# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.invalid-list.txt 2>&1 | \
-# RUN: FileCheck %s --check-prefix=FILE-ERROR -DFILE=no-such-file
+# RUN: FileCheck %s --check-prefix=FILE-ERROR -DFILE=no-such-file -DMSG=%errc_ENOENT
-# FILE-ERROR: error: '[[FILE]]': {{[nN]}}o such file or directory
+# FILE-ERROR: error: '[[FILE]]': [[MSG]]
## Check that an error is thrown when the directory exists but does not contain the requested file:
# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.invalid-list.txt,%t/dirname 2>&1 | \
-# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/dirname -DFILE=no-such-file
+# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/dirname -DFILE=no-such-file -DMSG=%errc_ENOENT
-# DIR-ERROR: error: '[[DIR]]{{[/\\]}}[[FILE]]': {{[nN]}}o such file or directory
+# DIR-ERROR: error: '[[DIR]]{{[/\\]}}[[FILE]]': [[MSG]]
## Check that an error is thrown when a file is in the cwd but dirname is specified:
# RUN: yaml2obj %S/Inputs/input2.yaml -o %basename_t.tmp-input2.o
# RUN: echo %basename_t.tmp-input2.o > %t.files-cwd.txt
# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.files-cwd.txt,%t/dirname 2>&1 | \
-# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/dirname -DFILE=%basename_t.tmp-input2.o
+# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/dirname -DFILE=%basename_t.tmp-input2.o -DMSG=%errc_ENOENT
## Check that an error is thrown when the directory doesn't exist:
# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.files-cwd.txt,%t/Invalid-Dir 2>&1 | \
-# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/Invalid-Dir -DFILE=%basename_t.tmp-input2.o
+# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/Invalid-Dir -DFILE=%basename_t.tmp-input2.o -DMSG=%errc_ENOENT
## Check that an error is thrown when the filelist is empty:
# RUN: touch %t.empty-list
@@ -102,7 +102,7 @@
# RUN: echo %t-input2.o > %t.space-line.txt
# RUN: echo " " >> %t.space-line.txt
# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.space-line.txt 2>&1 | \
-# RUN: FileCheck %s --check-prefix=FILE-ERROR -DFILE=' ' --strict-whitespace
+# RUN: FileCheck %s --check-prefix=FILE-ERROR -DFILE=' ' -DMSG=%errc_ENOENT --strict-whitespace
## Filelist option specified more than once:
# RUN: touch %t.list1.txt and %t.list2.txt
diff --git a/llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test b/llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test
index da1bcd4e9625..2a6d841475b1 100644
--- a/llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test
+++ b/llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test
@@ -26,9 +26,9 @@
## Input file not found:
# RUN: not llvm-libtool-darwin -static -o %t.lib %t.missing 2>&1 | \
-# RUN: FileCheck %s --check-prefix=NO-FILE -DFILE=%t.missing
+# RUN: FileCheck %s --check-prefix=NO-FILE -DFILE=%t.missing -DMSG=%errc_ENOENT
-# NO-FILE: error: '[[FILE]]': {{[nN]}}o such file or directory
+# NO-FILE: error: '[[FILE]]': [[MSG]]
## Input file is not an object file:
# RUN: touch %t.invalid
diff --git a/llvm/test/tools/llvm-lipo/create-arch.test b/llvm/test/tools/llvm-lipo/create-arch.test
index 08e9e18ca5e3..e29af7ce4efa 100644
--- a/llvm/test/tools/llvm-lipo/create-arch.test
+++ b/llvm/test/tools/llvm-lipo/create-arch.test
@@ -13,5 +13,5 @@
# # RUN: not llvm-lipo -arch i3866 %t-32.o -create -o /dev/null 2>&1 | FileCheck --check-prefix=INVALID_ARCH %s
# INVALID_ARCH: error: Invalid architecture: i3866
#
-# RUN: not llvm-lipo -arch i386 %t-33.o -create -o /dev/null 2>&1 | FileCheck --check-prefix=INVALID_FILE %s
-# INVALID_FILE: {{[nN]}}o such file or directory
+# RUN: not llvm-lipo -arch i386 %t-33.o -create -o /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT --check-prefix=INVALID_FILE %s
+# INVALID_FILE: [[MSG]]
diff --git a/llvm/test/tools/llvm-lipo/replace-invalid-input.test b/llvm/test/tools/llvm-lipo/replace-invalid-input.test
index 594594bc2ee6..c0ea4d783091 100644
--- a/llvm/test/tools/llvm-lipo/replace-invalid-input.test
+++ b/llvm/test/tools/llvm-lipo/replace-invalid-input.test
@@ -11,8 +11,8 @@
# RUN: not llvm-lipo %t-universal.o %t-universal.o -replace i386 %t-32.o -o %t.o 2>&1 | FileCheck --check-prefix=INPUT_ARGS %s
# INPUT_ARGS: error: replace expects a single input file
-# RUN: not llvm-lipo %t-universal.o -replace i386 %t-33.o -o %t.o 2>&1 | FileCheck --check-prefix=INVALID_FILE %s
-# INVALID_FILE: {{[nN]}}o such file or directory
+# RUN: not llvm-lipo %t-universal.o -replace i386 %t-33.o -o %t.o 2>&1 | FileCheck -DMSG=%errc_ENOENT --check-prefix=INVALID_FILE %s
+# INVALID_FILE: [[MSG]]
# RUN: not llvm-lipo %t-universal.o -replace i3866 %t-32.o -o %t.o 2>&1 | FileCheck --check-prefix=INVALID_ARCH %s
# INVALID_ARCH: error: Invalid architecture: i3866
diff --git a/llvm/test/tools/llvm-lto/error.ll b/llvm/test/tools/llvm-lto/error.ll
index e1f9e8813ab3..cadfa56fcbaf 100644
--- a/llvm/test/tools/llvm-lto/error.ll
+++ b/llvm/test/tools/llvm-lto/error.ll
@@ -1,5 +1,5 @@
-; RUN: not llvm-lto foobar 2>&1 | FileCheck %s
-; CHECK: llvm-lto: error loading file 'foobar': {{N|n}}o such file or directory
+; RUN: not llvm-lto foobar 2>&1 | FileCheck -DMSG=%errc_ENOENT %s
+; CHECK: llvm-lto: error loading file 'foobar': [[MSG]]
; RUN: not llvm-lto --list-symbols-only %S/Inputs/empty.bc 2>&1 | FileCheck %s --check-prefix=CHECK-LIST
; CHECK-LIST: llvm-lto: error loading file '{{.*}}/Inputs/empty.bc': The file was not recognized as a valid object file
diff --git a/llvm/test/tools/llvm-lto2/X86/stats-file-option.ll b/llvm/test/tools/llvm-lto2/X86/stats-file-option.ll
index 948c52202204..7daedd701781 100644
--- a/llvm/test/tools/llvm-lto2/X86/stats-file-option.ll
+++ b/llvm/test/tools/llvm-lto2/X86/stats-file-option.ll
@@ -21,5 +21,5 @@ define void @patatino() {
; Try to save statistics to an invalid file.
; RUN: not llvm-lto2 run %t1.bc -o %t.o -r %t1.bc,patatino,px \
-; RUN: -stats-file=%t2/foo.stats 2>&1 | FileCheck --check-prefix=ERROR %s
-; ERROR: LTO::run failed: {{[Nn]}}o such file or directory
+; RUN: -stats-file=%t2/foo.stats 2>&1 | FileCheck -DMSG=%errc_ENOENT --check-prefix=ERROR %s
+; ERROR: LTO::run failed: [[MSG]]
diff --git a/llvm/test/tools/llvm-mc/basic.test b/llvm/test/tools/llvm-mc/basic.test
index c7480dc6a87f..9953405c4233 100644
--- a/llvm/test/tools/llvm-mc/basic.test
+++ b/llvm/test/tools/llvm-mc/basic.test
@@ -1,3 +1,3 @@
-# RUN: not llvm-mc %t.blah -o /dev/null 2>&1 | FileCheck --check-prefix=ENOENT %s
+# RUN: not llvm-mc %t.blah -o /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT --check-prefix=ENOENT %s
-# ENOENT: {{.*}}.blah: {{[Nn]}}o such file or directory
+# ENOENT: {{.*}}.blah: [[MSG]]
diff --git a/llvm/test/tools/llvm-mca/invalid_input_file_name.test b/llvm/test/tools/llvm-mca/invalid_input_file_name.test
index 27fa972f29a4..548279e3131e 100644
--- a/llvm/test/tools/llvm-mca/invalid_input_file_name.test
+++ b/llvm/test/tools/llvm-mca/invalid_input_file_name.test
@@ -1,3 +1,3 @@
-# RUN: not llvm-mca %t.blah -o /dev/null 2>&1 | FileCheck --check-prefix=ENOENT %s
+# RUN: not llvm-mca %t.blah -o /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT --check-prefix=ENOENT %s
-# ENOENT: {{.*}}.blah: {{[Nn]}}o such file or directory
+# ENOENT: {{.*}}.blah: [[MSG]]
diff --git a/llvm/test/tools/llvm-ml/basic.test b/llvm/test/tools/llvm-ml/basic.test
index 960eb47f6cc5..b5e68d330af3 100644
--- a/llvm/test/tools/llvm-ml/basic.test
+++ b/llvm/test/tools/llvm-ml/basic.test
@@ -1,3 +1,3 @@
-# RUN: not llvm-ml %t.blah.asm /Fo /dev/null 2>&1 | FileCheck --check-prefix=ENOENT %s
+# RUN: not llvm-ml %t.blah.asm /Fo /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT --check-prefix=ENOENT %s
-# ENOENT: {{.*}}.blah.asm: {{[Nn]}}o such file or directory
+# ENOENT: {{.*}}.blah.asm: [[MSG]]
diff --git a/llvm/test/tools/llvm-objcopy/COFF/add-section.test b/llvm/test/tools/llvm-objcopy/COFF/add-section.test
index e4938db9135f..61434c242e60 100644
--- a/llvm/test/tools/llvm-objcopy/COFF/add-section.test
+++ b/llvm/test/tools/llvm-objcopy/COFF/add-section.test
@@ -59,9 +59,9 @@
## Test that llvm-objcopy produces an error if the file with section contents
## to be added does not exist.
-# RUN: not llvm-objcopy --add-section=.another.section=%t2 %t %t3 2>&1 | FileCheck -DFILE1=%t -DFILE2=%t2 %s --check-prefixes=ERR1
+# RUN: not llvm-objcopy --add-section=.another.section=%t2 %t %t3 2>&1 | FileCheck -DFILE1=%t -DFILE2=%t2 -DMSG=%errc_ENOENT %s --check-prefixes=ERR1
-# ERR1: error: '[[FILE1]]': '[[FILE2]]': {{[Nn]}}o such file or directory
+# ERR1: error: '[[FILE1]]': '[[FILE2]]': [[MSG]]
## Another negative test for invalid --add-sections command line argument.
# RUN: not llvm-objcopy --add-section=.another.section %t %t3 2>&1 | FileCheck %s --check-prefixes=ERR2
diff --git a/llvm/test/tools/llvm-objcopy/ELF/add-section.test b/llvm/test/tools/llvm-objcopy/ELF/add-section.test
index 290761f82bc1..dc4bbddba5c0 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/add-section.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/add-section.test
@@ -37,9 +37,9 @@ Sections:
## Test that llvm-objcopy produces an error if the file with section contents
## to be added does not exist.
-# RUN: not llvm-objcopy --add-section=.section.name=%t.missing %t %t.out 2>&1 | FileCheck -DFILE1=%t -DFILE2=%t.missing %s --check-prefixes=ERR1
+# RUN: not llvm-objcopy --add-section=.section.name=%t.missing %t %t.out 2>&1 | FileCheck -DFILE1=%t -DFILE2=%t.missing -DMSG=%errc_ENOENT %s --check-prefixes=ERR1
-# ERR1: error: '[[FILE1]]': '[[FILE2]]': {{[Nn]}}o such file or directory
+# ERR1: error: '[[FILE1]]': '[[FILE2]]': [[MSG]]
## Negative test for invalid --add-sections argument - missing '='.
# RUN: not llvm-objcopy --add-section=.section.name %t %t.out 2>&1 | FileCheck %s --check-prefixes=ERR2
diff --git a/llvm/test/tools/llvm-objcopy/ELF/error-format.test b/llvm/test/tools/llvm-objcopy/ELF/error-format.test
index 8a74fb0d1340..4e8a48ca582c 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/error-format.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/error-format.test
@@ -1,9 +1,9 @@
## This test shows that we include the tool name in error/warning messages.
-# RUN: not llvm-objcopy %S/non-existent 2>&1 | FileCheck --check-prefix=ERR %s -DTOOL=objcopy
-# RUN: not llvm-strip %S/non-existent 2>&1 | FileCheck --check-prefix=ERR %s -DTOOL=strip
+# RUN: not llvm-objcopy %S/non-existent 2>&1 | FileCheck --check-prefix=ERR %s -DTOOL=objcopy -DMSG=%errc_ENOENT
+# RUN: not llvm-strip %S/non-existent 2>&1 | FileCheck --check-prefix=ERR %s -DTOOL=strip -DMSG=%errc_ENOENT
-# ERR: llvm-[[TOOL]]{{(\.exe)?}}: error: '{{.*}}': {{[Nn]}}o such file or directory
+# ERR: llvm-[[TOOL]]{{(\.exe)?}}: error: '{{.*}}': [[MSG]]
## Currently llvm-objcopy does not issue warnings, so it is not tested.
diff --git a/llvm/test/tools/llvm-objcopy/MachO/add-section-error.test b/llvm/test/tools/llvm-objcopy/MachO/add-section-error.test
index a6847ec878bf..41f25cae04fc 100644
--- a/llvm/test/tools/llvm-objcopy/MachO/add-section-error.test
+++ b/llvm/test/tools/llvm-objcopy/MachO/add-section-error.test
@@ -5,8 +5,8 @@
## Error case 1: Nonexistent input file is specified by --add-section.
# RUN: not llvm-objcopy --add-section __TEXT,__text=%t.missing %t %t.nonexistent-file 2>&1 \
-# RUN: | FileCheck %s -DINPUT=%t -DSECTION_DATA_FILE=%t.missing --check-prefix=NONEXSITENT-FILE
-# NONEXSITENT-FILE: error: '[[INPUT]]': '[[SECTION_DATA_FILE]]': {{[Nn]}}o such file or directory
+# RUN: | FileCheck %s -DINPUT=%t -DSECTION_DATA_FILE=%t.missing -DMSG=%errc_ENOENT --check-prefix=NONEXSITENT-FILE
+# NONEXSITENT-FILE: error: '[[INPUT]]': '[[SECTION_DATA_FILE]]': [[MSG]]
## Error case 2: Too long segment name.
# RUN: not llvm-objcopy --add-section __TOOOOOOOOO_LONG,__text=%t.data %t %t.too-long-seg-name 2>&1 \
diff --git a/llvm/test/tools/llvm-objcopy/redefine-symbols.test b/llvm/test/tools/llvm-objcopy/redefine-symbols.test
index 8f6cba0c8243..ca713272d95f 100644
--- a/llvm/test/tools/llvm-objcopy/redefine-symbols.test
+++ b/llvm/test/tools/llvm-objcopy/redefine-symbols.test
@@ -13,8 +13,8 @@
# RUN: not llvm-objcopy --redefine-syms %t.rename.txt %t /dev/null 2>&1 | FileCheck %s --check-prefix=MISSING-SYM-NAME
# MISSING-SYM-NAME: error: {{.*}}.rename.txt:2: missing new symbol name
-# RUN: not llvm-objcopy --redefine-syms %t.rename-none.txt %t /dev/null 2>&1 | FileCheck %s --check-prefix=NO-FILE
-# NO-FILE: error: '{{.*}}.rename-none.txt': {{[Nn]}}o such file or directory
+# RUN: not llvm-objcopy --redefine-syms %t.rename-none.txt %t /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=NO-FILE
+# NO-FILE: error: '{{.*}}.rename-none.txt': [[MSG]]
!ELF
FileHeader:
diff --git a/llvm/test/tools/llvm-objcopy/wasm/dump-section.test b/llvm/test/tools/llvm-objcopy/wasm/dump-section.test
index 19620f7a3d33..3afcac27f597 100644
--- a/llvm/test/tools/llvm-objcopy/wasm/dump-section.test
+++ b/llvm/test/tools/llvm-objcopy/wasm/dump-section.test
@@ -4,14 +4,14 @@
# RUN: od -t x1 %t.sec | FileCheck %s
# RUN: not llvm-objcopy --dump-section=nonexistent=%t.sec %t 2>&1 | FileCheck --check-prefix=NONEXISTENT %s
-# RUN: not llvm-objcopy --dump-section=producers=%t.dir/bar %t 2>&1 | FileCheck --check-prefix=DIROUT %s
+# RUN: not llvm-objcopy --dump-section=producers=%t.dir/bar %t 2>&1 | FileCheck -DMSG=%errc_ENOENT --check-prefix=DIROUT %s
## Raw contents of the producers section.
# CHECK: 0000000 01 0c 70 72 6f 63 65 73 73 65 64 2d 62 79 01 05
# CHECK: 0000020 63 6c 61 6e 67 05 39 2e 30 2e 30
# NONEXISTENT: section 'nonexistent' not found
-# DIROUT: error: {{.*}}/bar': {{[nN]}}o such file or directory
+# DIROUT: error: {{.*}}/bar': [[MSG]]
## Check that dumping and removing a section works in the same invocation
# RUN: llvm-objcopy --dump-section=producers=%t.sec --remove-section=producers %t %t2
diff --git a/llvm/test/tools/llvm-profdata/weight-instr.test b/llvm/test/tools/llvm-profdata/weight-instr.test
index 83ea1ca6f6fa..db016d499429 100644
--- a/llvm/test/tools/llvm-profdata/weight-instr.test
+++ b/llvm/test/tools/llvm-profdata/weight-instr.test
@@ -73,8 +73,8 @@ RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar
INVALID_WEIGHT: error: Input weight must be a positive integer.
4- Bad merge: input path does not exist
-RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/does-not-exist.profdata -weighted-input=2,%p/Inputs/does-not-exist-either.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_INPUT
-INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.profdata: {{[Nn]}}o such file or directory
+RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/does-not-exist.profdata -weighted-input=2,%p/Inputs/does-not-exist-either.profdata -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT
+INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.profdata: [[MSG]]
5- No inputs
RUN: not llvm-profdata merge -instr -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT
diff --git a/llvm/test/tools/llvm-profdata/weight-sample.test b/llvm/test/tools/llvm-profdata/weight-sample.test
index 635e6212e790..6ba47da9fcb1 100644
--- a/llvm/test/tools/llvm-profdata/weight-sample.test
+++ b/llvm/test/tools/llvm-profdata/weight-sample.test
@@ -48,8 +48,8 @@ RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-b
INVALID_WEIGHT: error: Input weight must be a positive integer.
4- Bad merge: input path does not exist
-RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/does-not-exist.proftext -weighted-input=2,%p/Inputs/does-not-exist-either.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_INPUT
-INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.proftext: {{[Nn]}}o such file or directory
+RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/does-not-exist.proftext -weighted-input=2,%p/Inputs/does-not-exist-either.proftext -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT
+INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.proftext: [[MSG]]
5- No inputs
RUN: not llvm-profdata merge -sample -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT
diff --git a/llvm/test/tools/llvm-readobj/ELF/thin-archive-paths.test b/llvm/test/tools/llvm-readobj/ELF/thin-archive-paths.test
index 996fae42cedb..54c67ed5c945 100644
--- a/llvm/test/tools/llvm-readobj/ELF/thin-archive-paths.test
+++ b/llvm/test/tools/llvm-readobj/ELF/thin-archive-paths.test
@@ -14,9 +14,9 @@
# Show that relative paths in an error message for both archive and member look
# sensible.
# RUN: rm a/b/1.o
-# RUN: not llvm-readobj --file-headers a/relative.a 2>&1 | FileCheck %s --check-prefix=ERR1
-# RUN: not llvm-readelf --file-headers a/relative.a 2>&1 | FileCheck %s --check-prefix=ERR1
-# ERR1: error: 'a/relative.a': 'b/1.o': {{[Nn]}}o such file or directory
+# RUN: not llvm-readobj --file-headers a/relative.a 2>&1 | FileCheck %s --check-prefix=ERR1 -DMSG=%errc_ENOENT
+# RUN: not llvm-readelf --file-headers a/relative.a 2>&1 | FileCheck %s --check-prefix=ERR1 -DMSG=%errc_ENOENT
+# ERR1: error: 'a/relative.a': 'b/1.o': [[MSG]]
# RUN: mkdir -p %t/c
# RUN: yaml2obj %s -o a/b/1.o
@@ -28,9 +28,9 @@
# Show that absolute paths in an error message for both archive and member are correct.
# RUN: rm a/b/1.o
-# RUN: not llvm-readobj --file-headers %/t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%/t
-# RUN: not llvm-readelf --file-headers %/t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%/t
-# ERR2: error: '[[DIR]]/c/absolute.a': '[[DIR]]/a/b/1.o': {{[Nn]}}o such file or directory
+# RUN: not llvm-readobj --file-headers %/t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%/t -DMSG=%errc_ENOENT
+# RUN: not llvm-readelf --file-headers %/t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%/t -DMSG=%errc_ENOENT
+# ERR2: error: '[[DIR]]/c/absolute.a': '[[DIR]]/a/b/1.o': [[MSG]]
--- !ELF
FileHeader:
diff --git a/llvm/test/tools/llvm-readobj/basic.test b/llvm/test/tools/llvm-readobj/basic.test
index 5c5abee108c2..08c83ad91000 100644
--- a/llvm/test/tools/llvm-readobj/basic.test
+++ b/llvm/test/tools/llvm-readobj/basic.test
@@ -1,8 +1,8 @@
## Test case where input file does not exit.
-RUN: not llvm-readobj %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readobj %s
-RUN: not llvm-readelf %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readelf %s
+RUN: not llvm-readobj %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readobj -DMSG=%errc_ENOENT %s
+RUN: not llvm-readelf %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readelf -DMSG=%errc_ENOENT %s
-ENOENT: llvm-[[TOOL]]{{(\.exe)?}}: error: '{{.*}}.blah': {{[Nn]}}o such file or directory
+ENOENT: llvm-[[TOOL]]{{(\.exe)?}}: error: '{{.*}}.blah': [[MSG]]
# Test case with no input file.
RUN: not llvm-readobj 2>&1 | FileCheck %s --check-prefix=NO-FILE
diff --git a/llvm/test/tools/llvm-readobj/thin-archive.test b/llvm/test/tools/llvm-readobj/thin-archive.test
index d13ae23e1b89..91383d065769 100644
--- a/llvm/test/tools/llvm-readobj/thin-archive.test
+++ b/llvm/test/tools/llvm-readobj/thin-archive.test
@@ -55,12 +55,12 @@
# Remove the second member and show that the first can still be dumped, but that the last isn't.
# RUN: rm %t/2.o
# RUN: not llvm-readobj --file-headers %t.a 2> %t.err | FileCheck %s --check-prefix=MISSING
-# RUN: FileCheck %s --check-prefix=ERR --input-file=%t.err
+# RUN: FileCheck -DMSG=%errc_ENOENT %s --check-prefix=ERR --input-file=%t.err
# MISSING: File: {{.*}}1.o
# MISSING: Format: elf64-x86-64
# MISSING-NOT: File: {{.*}}3.o
-# ERR: error: '{{.*}}.a': '{{.*}}2.o': {{[Nn]}}o such file or directory
+# ERR: error: '{{.*}}.a': '{{.*}}2.o': [[MSG]]
--- !ELF
FileHeader:
diff --git a/llvm/test/tools/llvm-size/no-input.test b/llvm/test/tools/llvm-size/no-input.test
index 37e5745bf177..d8fe0f5b3334 100644
--- a/llvm/test/tools/llvm-size/no-input.test
+++ b/llvm/test/tools/llvm-size/no-input.test
@@ -1,7 +1,7 @@
## Show that llvm-size emits an error if passed in a non-existent file.
-# RUN: not llvm-size %t.blah 2>&1 | FileCheck %s -DFILE=%t.blah --check-prefix=ENOENT
-# ENOENT: {{.*}}llvm-size{{.*}}: error: '[[FILE]]': {{[Nn]}}o such file or directory
+# RUN: not llvm-size %t.blah 2>&1 | FileCheck %s -DFILE=%t.blah -DMSG=%errc_ENOENT --check-prefix=ENOENT
+# ENOENT: {{.*}}llvm-size{{.*}}: error: '[[FILE]]': [[MSG]]
## Show that llvm-size reads a.out if not passed any file.
diff --git a/llvm/test/tools/llvm-symbolizer/pdb/missing_pdb.test b/llvm/test/tools/llvm-symbolizer/pdb/missing_pdb.test
index b83b46a75213..c6caea1e72b5 100644
--- a/llvm/test/tools/llvm-symbolizer/pdb/missing_pdb.test
+++ b/llvm/test/tools/llvm-symbolizer/pdb/missing_pdb.test
@@ -1,10 +1,10 @@
RUN: llvm-symbolizer 0x401000 0x401001 -obj="%p/Inputs/missing_pdb.exe" 2>%t.err \
RUN: | FileCheck %s
-RUN: FileCheck --check-prefix=ERROR %s < %t.err
+RUN: FileCheck -DMSG=%errc_ENOENT --check-prefix=ERROR %s < %t.err
llvm-symbolizer should print one error and two unknown line info records.
-ERROR: LLVMSymbolizer: error reading file: {{.*}}: {{N|n}}o such file or directory
+ERROR: LLVMSymbolizer: error reading file: {{.*}}: [[MSG]]
ERROR-NOT: error reading file
CHECK: ??
diff --git a/llvm/test/tools/llvm-xray/X86/no-such-file.txt b/llvm/test/tools/llvm-xray/X86/no-such-file.txt
index 69fc43f9625b..51373346c38e 100644
--- a/llvm/test/tools/llvm-xray/X86/no-such-file.txt
+++ b/llvm/test/tools/llvm-xray/X86/no-such-file.txt
@@ -1,4 +1,4 @@
-; RUN: not llvm-xray extract no-such-file 2>&1 | FileCheck %s
+; RUN: not llvm-xray extract no-such-file 2>&1 | FileCheck -DMSG=%errc_ENOENT %s
; CHECK: llvm-xray: Cannot extract instrumentation map from 'no-such-file'.
-; CHECK-NEXT: {{[Nn]}}o such file or directory
+; CHECK-NEXT: [[MSG]]
diff --git a/llvm/test/tools/obj2yaml/invalid_input_file.test b/llvm/test/tools/obj2yaml/invalid_input_file.test
index 0f1bac1be01a..aa2b91260d90 100644
--- a/llvm/test/tools/obj2yaml/invalid_input_file.test
+++ b/llvm/test/tools/obj2yaml/invalid_input_file.test
@@ -1,3 +1,3 @@
-# RUN: not obj2yaml %p/path/does/not/exist 2>&1 | FileCheck %s
+# RUN: not obj2yaml %p/path/does/not/exist 2>&1 | FileCheck -DMSG=%errc_ENOENT %s
-# CHECK: Error reading file: {{.*}}/path/does/not/exist: {{[Nn]}}o such file or directory
+# CHECK: Error reading file: {{.*}}/path/does/not/exist: [[MSG]]
diff --git a/llvm/test/tools/yaml2obj/output-file.yaml b/llvm/test/tools/yaml2obj/output-file.yaml
index e900291fc4c0..c3c807db0ede 100644
--- a/llvm/test/tools/yaml2obj/output-file.yaml
+++ b/llvm/test/tools/yaml2obj/output-file.yaml
@@ -7,9 +7,9 @@
# RUN: yaml2obj %s -o%t
# RUN: ls %t
-# RUN: not yaml2obj -o %p/path/does/not/exist 2>&1 | FileCheck %s
+# RUN: not yaml2obj -o %p/path/does/not/exist 2>&1 | FileCheck -DMSG=%errc_ENOENT %s
-# CHECK: yaml2obj: error: failed to open '{{.*}}/path/does/not/exist': {{[Nn]}}o such file or directory
+# CHECK: yaml2obj: error: failed to open '{{.*}}/path/does/not/exist': [[MSG]]
!ELF
FileHeader:
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index 949c5e694db7..d4cd3e9dee56 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -345,6 +345,17 @@ def add_tool_substitutions(self, tools, search_dirs=None):
self.config.substitutions.extend(substitutions)
return True
+ def add_err_msg_substitutions(self):
+ if (sys.platform == 'zos'):
+ self.config.substitutions.append(('%errc_ENOENT', '\'EDC5129I No such file or directory.\''))
+ self.config.substitutions.append(('%errc_EISDIR', '\'EDC5123I Is a directory.\''))
+ elif (sys.platform == 'win32'):
+ self.config.substitutions.append(('%errc_ENOENT', '\'no such file or directory\''))
+ self.config.substitutions.append(('%errc_EISDIR', '\'is a directory\''))
+ else:
+ self.config.substitutions.append(('%errc_ENOENT', '\'No such file or directory\''))
+ self.config.substitutions.append(('%errc_EISDIR', '\'Is a directory\''))
+
def use_default_substitutions(self):
tool_patterns = [
ToolSubst('FileCheck', unresolved='fatal'),
@@ -358,6 +369,8 @@ def use_default_substitutions(self):
self.add_tool_substitutions(
tool_patterns, [self.config.llvm_tools_dir])
+ self.add_err_msg_substitutions()
+
def use_llvm_tool(self, name, search_env=None, required=False, quiet=False):
"""Find the executable program 'name', optionally using the specified
environment variable as an override before searching the
More information about the llvm-commits
mailing list