[lld] e59d336 - [test] Use host platform specific error message substitution in lit tests - continued

Abhina Sreeskantharajan via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 06:53:33 PST 2021


Author: Abhina Sreeskantharajan
Date: 2021-02-03T09:53:22-05:00
New Revision: e59d336e75f4670b1a702c2281b3fed27ba4c426

URL: https://github.com/llvm/llvm-project/commit/e59d336e75f4670b1a702c2281b3fed27ba4c426
DIFF: https://github.com/llvm/llvm-project/commit/e59d336e75f4670b1a702c2281b3fed27ba4c426.diff

LOG: [test] Use host platform specific error message substitution in lit tests - continued

On z/OS, other error messages are not matched correctly in lit tests.

```
EDC5121I Invalid argument.
EDC5111I Permission denied.
```

This patch adds a lit substitution to fix it.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D95808

Added: 
    

Modified: 
    clang/test/Analysis/taint-generic.c
    clang/test/Format/style-on-command-line.cpp
    lld/test/COFF/thinlto-emit-imports.ll
    lld/test/ELF/lto/resolution-err.ll
    lld/test/ELF/lto/thinlto-cant-write-index.ll
    lld/test/ELF/lto/thinlto-emit-imports.ll
    llvm/docs/TestingGuide.rst
    llvm/test/tools/llvm-ar/error-opening-permission.test
    llvm/test/tools/llvm-elfabi/fail-file-write.test
    llvm/test/tools/yaml2obj/ELF/DWARF/debug-gnu-pubnames.yaml
    llvm/utils/lit/lit/llvm/config.py

Removed: 
    


################################################################################
diff  --git a/clang/test/Analysis/taint-generic.c b/clang/test/Analysis/taint-generic.c
index 1cc1913eb9a8..2cbd580168ba 100644
--- a/clang/test/Analysis/taint-generic.c
+++ b/clang/test/Analysis/taint-generic.c
@@ -28,11 +28,11 @@
 // RUN:   -analyzer-checker=alpha.security.taint \
 // RUN:   -analyzer-config \
 // RUN:     alpha.security.taint.TaintPropagation:Config=%S/Inputs/taint-generic-config-ill-formed.yaml \
-// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-ILL-FORMED
+// RUN:   2>&1 | FileCheck -DMSG=%errc_EINVAL %s -check-prefix=CHECK-ILL-FORMED
 
 // CHECK-ILL-FORMED: (frontend): invalid input for checker option
 // CHECK-ILL-FORMED-SAME:        'alpha.security.taint.TaintPropagation:Config',
-// CHECK-ILL-FORMED-SAME:        that expects a valid yaml file: {{[Ii]}}nvalid argument
+// CHECK-ILL-FORMED-SAME:        that expects a valid yaml file: [[MSG]]
 
 // RUN: not %clang_analyze_cc1 -verify %s \
 // RUN:   -analyzer-checker=alpha.security.taint \

diff  --git a/clang/test/Format/style-on-command-line.cpp b/clang/test/Format/style-on-command-line.cpp
index ba06babee35a..3fd89f587dc6 100644
--- a/clang/test/Format/style-on-command-line.cpp
+++ b/clang/test/Format/style-on-command-line.cpp
@@ -1,7 +1,7 @@
 // RUN: clang-format -style="{BasedOnStyle: Google, IndentWidth: 8}" %s | FileCheck -strict-whitespace -check-prefix=CHECK1 %s
 // RUN: clang-format -style="{BasedOnStyle: LLVM, IndentWidth: 7}" %s | FileCheck -strict-whitespace -check-prefix=CHECK2 %s
-// RUN: not clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" -fallback-style=LLVM %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s
-// RUN: not clang-format -style="{lsjd}" %s -fallback-style=LLVM 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s
+// RUN: not clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" -fallback-style=LLVM %s 2>&1 | FileCheck -DMSG=%errc_EINVAL -strict-whitespace -check-prefix=CHECK3 %s
+// RUN: not clang-format -style="{lsjd}" %s -fallback-style=LLVM 2>&1 | FileCheck -DMSG=%errc_EINVAL -strict-whitespace -check-prefix=CHECK4 %s
 // RUN: mkdir -p %t
 // RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %t/.clang-format
 // RUN: clang-format -style=file -assume-filename=%t/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
@@ -24,8 +24,8 @@ void f() {
 // CHECK1: {{^        int\* i;$}}
 // CHECK2: {{^       int \*i;$}}
 // CHECK3: Unknown value for BasedOnStyle: invalid
-// CHECK3: Error parsing -style: {{I|i}}nvalid argument
-// CHECK4: Error parsing -style: {{I|i}}nvalid argument
+// CHECK3: Error parsing -style: [[MSG]]
+// CHECK4: Error parsing -style: [[MSG]]
 // CHECK5: {{^     int\* i;$}}
 // CHECK6: {{^Error reading .*\.clang-format: (I|i)nvalid argument}}
 // CHECK7: {{^      int\* i;$}}

diff  --git a/lld/test/COFF/thinlto-emit-imports.ll b/lld/test/COFF/thinlto-emit-imports.ll
index 9ffe3b267701..a9f22c1dc2dc 100644
--- a/lld/test/COFF/thinlto-emit-imports.ll
+++ b/lld/test/COFF/thinlto-emit-imports.ll
@@ -34,8 +34,8 @@
 ; RUN: chmod 400 %t3.obj.imports
 ; RUN: not lld-link -entry:main -thinlto-index-only \
 ; RUN:     -thinlto-emit-imports-files %t1.obj %t2.obj %t3.obj \
-; RUN:     -out:%t4.exe 2>&1 | FileCheck %s --check-prefix=ERR
-; ERR: cannot open {{.*}}3.obj.imports: {{P|p}}ermission denied
+; RUN:     -out:%t4.exe 2>&1 | FileCheck -DMSG=%errc_EACCES %s --check-prefix=ERR
+; ERR: cannot open {{.*}}3.obj.imports: [[MSG]]
 
 ; Ensure lld doesn't generate import files when thinlto-index-only is not enabled
 ; RUN: rm -f %t1.obj.imports

diff  --git a/lld/test/ELF/lto/resolution-err.ll b/lld/test/ELF/lto/resolution-err.ll
index 00cdd94059ac..ae073aa1da11 100644
--- a/lld/test/ELF/lto/resolution-err.ll
+++ b/lld/test/ELF/lto/resolution-err.ll
@@ -3,10 +3,10 @@
 ; RUN: llvm-as %s -o %t.bc
 ; RUN: touch %t.resolution.txt
 ; RUN: chmod -w %t.resolution.txt
-; RUN: not ld.lld -save-temps %t.bc -o %t 2>&1 | FileCheck %s
+; RUN: not ld.lld -save-temps %t.bc -o %t 2>&1 | FileCheck -DMSG=%errc_EACCES %s
 ; RUN: rm -f %t.resolution.txt
 
-; CHECK: error: {{[Pp]}}ermission denied{{$}}
+; CHECK: error: [[MSG]]
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"

diff  --git a/lld/test/ELF/lto/thinlto-cant-write-index.ll b/lld/test/ELF/lto/thinlto-cant-write-index.ll
index 45e35ffd5739..e664acbb17de 100644
--- a/lld/test/ELF/lto/thinlto-cant-write-index.ll
+++ b/lld/test/ELF/lto/thinlto-cant-write-index.ll
@@ -8,9 +8,9 @@
 ; RUN: rm -f %t2.o.thinlto.bc
 ; RUN: touch %t2.o.thinlto.bc
 ; RUN: chmod u-w %t2.o.thinlto.bc
-; RUN: not ld.lld --plugin-opt=thinlto-index-only -shared %t1.o %t2.o -o /dev/null 2>&1 | FileCheck %s
+; RUN: not ld.lld --plugin-opt=thinlto-index-only -shared %t1.o %t2.o -o /dev/null 2>&1 | FileCheck -DMSG=%errc_EACCES %s
 ; RUN: chmod u+w %t2.o.thinlto.bc
-; CHECK: cannot open {{.*}}2.o.thinlto.bc: {{P|p}}ermission denied
+; CHECK: cannot open {{.*}}2.o.thinlto.bc: [[MSG]]
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"

diff  --git a/lld/test/ELF/lto/thinlto-emit-imports.ll b/lld/test/ELF/lto/thinlto-emit-imports.ll
index 25466a1663c1..fcddd18cc744 100644
--- a/lld/test/ELF/lto/thinlto-emit-imports.ll
+++ b/lld/test/ELF/lto/thinlto-emit-imports.ll
@@ -31,8 +31,8 @@
 ; RUN: rm -f %t3.o.imports
 ; RUN: touch %t3.o.imports
 ; RUN: chmod 400 %t3.o.imports
-; RUN: not ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-emit-imports-files -shared %t1.o %t2.o %t3.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR
-; ERR: cannot open {{.*}}3.o.imports: {{P|p}}ermission denied
+; RUN: not ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-emit-imports-files -shared %t1.o %t2.o %t3.o -o /dev/null 2>&1 | FileCheck -DMSG=%errc_EACCES %s --check-prefix=ERR
+; ERR: cannot open {{.*}}3.o.imports: [[MSG]]
 
 ; Ensure lld doesn't generate import files when thinlto-index-only is not enabled
 ; RUN: rm -f %t1.o.imports

diff  --git a/llvm/docs/TestingGuide.rst b/llvm/docs/TestingGuide.rst
index d87b8d50d453..dd8601f3062c 100644
--- a/llvm/docs/TestingGuide.rst
+++ b/llvm/docs/TestingGuide.rst
@@ -542,7 +542,8 @@ RUN lines:
  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.
+   The following error codes are currently supported:
+   ENOENT, EISDIR, EINVAL, EACCES.
 
    Example: ``Linux %errc_ENOENT: No such file or directory``
 

diff  --git a/llvm/test/tools/llvm-ar/error-opening-permission.test b/llvm/test/tools/llvm-ar/error-opening-permission.test
index d8d0cbfd3556..4107bdfc044f 100644
--- a/llvm/test/tools/llvm-ar/error-opening-permission.test
+++ b/llvm/test/tools/llvm-ar/error-opening-permission.test
@@ -9,6 +9,6 @@
 # RUN: llvm-ar rc %t/permission.b %t/1.txt
 # RUN: chmod 100 %t/permission.b
 # RUN: not llvm-ar p %t/permission.b 2>&1 | \
-# RUN:   FileCheck %s --check-prefix=NO-PERMISSION -DARCHIVE=%t/permission.b
+# RUN:   FileCheck %s --check-prefix=NO-PERMISSION -DARCHIVE=%t/permission.b -DMSG=%errc_EACCES
 
-# NO-PERMISSION: error: unable to open '[[ARCHIVE]]': {{.*}}{{[pP]}}ermission denied
+# NO-PERMISSION: error: unable to open '[[ARCHIVE]]': [[MSG]]

diff  --git a/llvm/test/tools/llvm-elfabi/fail-file-write.test b/llvm/test/tools/llvm-elfabi/fail-file-write.test
index c3c479e73887..928528d16c69 100644
--- a/llvm/test/tools/llvm-elfabi/fail-file-write.test
+++ b/llvm/test/tools/llvm-elfabi/fail-file-write.test
@@ -5,7 +5,7 @@
 # RUN: mkdir %t.TestDir
 # RUN: touch %t.TestDir/Output.TestFile
 # RUN: chmod 400 %t.TestDir
-# RUN: not llvm-elfabi %s --output-target=elf64-little %t.TestDir/Output.TestFile 2>&1 | FileCheck %s --check-prefix=ERR
+# RUN: not llvm-elfabi %s --output-target=elf64-little %t.TestDir/Output.TestFile 2>&1 | FileCheck -DMSG=%errc_EACCES %s --check-prefix=ERR
 # RUN: chmod 777 %t.TestDir
 # RUN: rm -rf %t.TestDir
 
@@ -15,4 +15,4 @@ Arch: AArch64
 Symbols: {}
 ...
 
-# ERR: {{.*}}Permission denied{{.*}} when trying to open `{{.*}}.TestDir/Output.TestFile` for writing
+# ERR: [[MSG]] when trying to open `{{.*}}.TestDir/Output.TestFile` for writing

diff  --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-gnu-pubnames.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-gnu-pubnames.yaml
index 57a6c60d01ca..610609c17b22 100644
--- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-gnu-pubnames.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-gnu-pubnames.yaml
@@ -225,12 +225,12 @@ DWARF:
 
 ## h) Test that yaml2obj emits an error if 'Descriptor' is missing.
 
-# RUN: not yaml2obj --docnum=8 %s -o %t8.o 2>&1 | FileCheck %s --check-prefix=MISSING-KEY --ignore-case
+# RUN: not yaml2obj --docnum=8 %s -o %t8.o 2>&1 | FileCheck -DMSG=%errc_EINVAL %s --check-prefix=MISSING-KEY --ignore-case
 
 #      MISSING-KEY: YAML:{{.*}}:9: error: missing required key 'Descriptor'
 # MISSING-KEY-NEXT:       - DieOffset: 0x12345678
 # MISSING-KEY-NEXT:         ^
-# MISSING-KEY-NEXT: yaml2obj: error: failed to parse YAML input: Invalid argument
+# MISSING-KEY-NEXT: yaml2obj: error: failed to parse YAML input: [[MSG]]
 
 --- !ELF
 FileHeader:

diff  --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index d4cd3e9dee56..81b2b2a194dd 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -349,12 +349,18 @@ 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.\''))
+            self.config.substitutions.append(('%errc_EINVAL', '\'EDC5121I Invalid argument.\''))
+            self.config.substitutions.append(('%errc_EACCES', '\'EDC5111I Permission denied.\''))
         elif (sys.platform == 'win32'):
             self.config.substitutions.append(('%errc_ENOENT', '\'no such file or directory\''))
             self.config.substitutions.append(('%errc_EISDIR', '\'is a directory\''))
+            self.config.substitutions.append(('%errc_EINVAL', '\'invalid argument\''))
+            self.config.substitutions.append(('%errc_EACCES', '\'permission denied\''))
         else:
             self.config.substitutions.append(('%errc_ENOENT', '\'No such file or directory\''))
             self.config.substitutions.append(('%errc_EISDIR', '\'Is a directory\''))
+            self.config.substitutions.append(('%errc_EINVAL', '\'Invalid argument\''))
+            self.config.substitutions.append(('%errc_EACCES', '\'Permission denied\''))
 
     def use_default_substitutions(self):
         tool_patterns = [


        


More information about the llvm-commits mailing list