1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[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
This commit is contained in:
Abhina Sreeskantharajan 2021-01-29 07:15:50 -05:00
parent 5b26973941
commit 8fb00b74f1
43 changed files with 125 additions and 102 deletions

View File

@ -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 different 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:**

View File

@ -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]]

View File

@ -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]]

View File

@ -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]]

View File

@ -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]]

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -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: ---

View File

@ -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]]

View File

@ -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]]

View File

@ -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:

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -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]]

View File

@ -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]]

View File

@ -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

View File

@ -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

View File

@ -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]]

View File

@ -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

View File

@ -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

View File

@ -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]]

View File

@ -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]]

View File

@ -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]]

View File

@ -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]]

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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 \

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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:

View File

@ -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.

View File

@ -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: ??

View File

@ -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]]

View File

@ -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]]

View File

@ -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:

View File

@ -345,6 +345,17 @@ class LLVMConfig(object):
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 @@ class LLVMConfig(object):
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