[clang] ce19343 - [test] Use host platform specific error message substitution

Abhina Sreeskantharajan via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 16 12:13:59 PDT 2022


Author: Abhina Sreeskantharajan
Date: 2022-09-16T15:13:45-04:00
New Revision: ce193431141d8f16d6b511a9114879105b0739e1

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

LOG: [test] Use host platform specific error message substitution

This patch modifies the testcase to use error substitution so it will pass on all platforms.

Reviewed By: fanbo-meng, zibi

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

Added: 
    

Modified: 
    clang/test/Format/style-on-command-line.cpp
    llvm/test/tools/llvm-dis/errors.test
    llvm/test/tools/llvm-dwp/X86/diagnose_missing_dwos.test
    llvm/test/tools/llvm-reduce/mir/input-file-does-not-exist.mir
    llvm/test/tools/llvm-tapi-diff/misspelled-tbd.test

Removed: 
    


################################################################################
diff  --git a/clang/test/Format/style-on-command-line.cpp b/clang/test/Format/style-on-command-line.cpp
index 9825269ef0715..ce2577beec86a 100644
--- a/clang/test/Format/style-on-command-line.cpp
+++ b/clang/test/Format/style-on-command-line.cpp
@@ -6,7 +6,7 @@
 // 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
 // RUN: printf "Invalid:\n" > %t/.clang-format
-// RUN: not clang-format -style=file -fallback-style=webkit -assume-filename=%t/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
+// RUN: not clang-format -style=file -fallback-style=webkit -assume-filename=%t/foo.cpp < %s 2>&1 | FileCheck -DMSG=%errc_EINVAL -strict-whitespace -check-prefix=CHECK6 %s
 // RUN: rm %t/.clang-format
 // RUN: printf "BasedOnStyle: google\nIndentWidth: 6\n" > %t/_clang-format
 // RUN: clang-format -style=file -assume-filename=%t/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK7 %s
@@ -35,7 +35,7 @@ void f() {
 // CHECK4: Error parsing -style: [[MSG]]
 // CHECK5: {{^     int\* i;$}}
 // CHECK6: unknown key 'Invalid'
-// CHECK6: {{^Error reading .*\.clang-format: (I|i)nvalid argument}}
+// CHECK6: {{^Error reading .*\.clang-format:}} [[MSG]]
 // CHECK7: {{^      int\* i;$}}
 // CHECK8: {{^  int\* i;$}}
 // CHECK9: {{^    int \*i;$}}

diff  --git a/llvm/test/tools/llvm-dis/errors.test b/llvm/test/tools/llvm-dis/errors.test
index 27c37b2186a32..4e4b60f72dfd0 100644
--- a/llvm/test/tools/llvm-dis/errors.test
+++ b/llvm/test/tools/llvm-dis/errors.test
@@ -1,3 +1,3 @@
-# RUN: not llvm-dis missing-file-path 2>&1 | FileCheck %s --check-prefix=MISSING --ignore-case
+# RUN: not llvm-dis missing-file-path 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=MISSING --ignore-case
 
-# MISSING: error: missing-file-path: no such file or directory
+# MISSING: error: missing-file-path: [[MSG]]

diff  --git a/llvm/test/tools/llvm-dwp/X86/diagnose_missing_dwos.test b/llvm/test/tools/llvm-dwp/X86/diagnose_missing_dwos.test
index 8d71cf5d5c301..961ea8675d23e 100644
--- a/llvm/test/tools/llvm-dwp/X86/diagnose_missing_dwos.test
+++ b/llvm/test/tools/llvm-dwp/X86/diagnose_missing_dwos.test
@@ -3,11 +3,11 @@ RUN: mkdir %t
 RUN: cd %t
 RUN: cp %p/../Inputs/dwos_list_from_exec/b.dwo b.dwo
 RUN: cp %p/../Inputs/dwos_list_from_exec/main main
-RUN: not llvm-dwp -e binary -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-BIN
-RUN: not llvm-dwp -e main -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-1ST-DWO
+RUN: not llvm-dwp -e binary -o /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=CHECK-BIN
+RUN: not llvm-dwp -e main -o /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=CHECK-1ST-DWO
 RUN: cp %p/../Inputs/dwos_list_from_exec/a.dwo a.dwo
 RUN: rm b.dwo
-RUN: not llvm-dwp -e main -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-2ND-DWO
+RUN: not llvm-dwp -e main -o /dev/null 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=CHECK-2ND-DWO
 
 Build commands for the test binaries:
 
@@ -23,6 +23,6 @@ b.cpp:
      return 0;
   }
 
-CHECK-BIN: error: 'binary': {{[Nn]}}o such file or directory
-CHECK-1ST-DWO: error: './a.dwo': {{[Nn]}}o such file or directory
-CHECK-2ND-DWO: error: './b.dwo': {{[Nn]}}o such file or directory
+CHECK-BIN: error: 'binary': [[MSG]]
+CHECK-1ST-DWO: error: './a.dwo': [[MSG]]
+CHECK-2ND-DWO: error: './b.dwo': [[MSG]]

diff  --git a/llvm/test/tools/llvm-reduce/mir/input-file-does-not-exist.mir b/llvm/test/tools/llvm-reduce/mir/input-file-does-not-exist.mir
index 9147bf9dac99d..4e39948a2ecb1 100644
--- a/llvm/test/tools/llvm-reduce/mir/input-file-does-not-exist.mir
+++ b/llvm/test/tools/llvm-reduce/mir/input-file-does-not-exist.mir
@@ -1,4 +1,4 @@
 # REQUIRES: amdgpu-registered-target
-# RUN: not llvm-reduce -mtriple=amdgcn-amd-amdhsa --test FileCheck --test-arg %s --test-arg --input-file does-not-exist.mir 2>&1 | FileCheck -check-prefix=ERR %s
+# RUN: not llvm-reduce -mtriple=amdgcn-amd-amdhsa --test FileCheck --test-arg %s --test-arg --input-file does-not-exist.mir 2>&1 | FileCheck -DMSG=%errc_ENOENT -check-prefix=ERR %s
 
-# ERR: {{.*}}llvm-reduce{{.*}}: {{[Nn]}}o such file or directory
+# ERR: {{.*}}llvm-reduce{{.*}}: [[MSG]]

diff  --git a/llvm/test/tools/llvm-tapi-
diff /misspelled-tbd.test b/llvm/test/tools/llvm-tapi-
diff /misspelled-tbd.test
index 0df8af46f8aec..b09000fd1af7f 100644
--- a/llvm/test/tools/llvm-tapi-
diff /misspelled-tbd.test
+++ b/llvm/test/tools/llvm-tapi-
diff /misspelled-tbd.test
@@ -1,3 +1,3 @@
-; RUN: not llvm-tapi-
diff  %S/Inputs/v4A.tbd %S/Inputs/v4.tbd 2>&1 | FileCheck %s
+; RUN: not llvm-tapi-
diff  %S/Inputs/v4A.tbd %S/Inputs/v4.tbd 2>&1 | FileCheck -DMSG=%errc_ENOENT %s
 
-; CHECK: error: {{.*}}v4.tbd' {{[Nn]}}o such file or directory
+; CHECK: error: {{.*}}v4.tbd' [[MSG]]


        


More information about the cfe-commits mailing list