[clang-tools-extra] [llvm] Full path names are used in several unittests instead of the binary name. Fix up the testcase failures (PR #107974)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 22:30:52 PDT 2024


https://github.com/HighW4y2H3ll created https://github.com/llvm/llvm-project/pull/107974

Encountered several testcase failures when running `ninja check-all`. It was due to the full path name were shown in the error message instead of the binary name, and therefore causing the check string mismatch.

>From 31a8c50f50c5294027845e3401950e0421f507ac Mon Sep 17 00:00:00 2001
From: h2h <h2h at meta.com>
Date: Sun, 8 Sep 2024 21:26:52 -0700
Subject: [PATCH] Fix up test case failures

---
 clang-tools-extra/clangd/test/log.test                          | 2 +-
 clang-tools-extra/test/clang-query/invalid-command-line.cpp     | 2 +-
 .../test/clang-tidy/infrastructure/invalid-command-line.cpp     | 2 +-
 llvm/utils/lit/tests/shtest-output-printing.py                  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/clangd/test/log.test b/clang-tools-extra/clangd/test/log.test
index 7a53d361ddde5f..5cc871972f9892 100644
--- a/clang-tools-extra/clangd/test/log.test
+++ b/clang-tools-extra/clangd/test/log.test
@@ -1,7 +1,7 @@
 # RUN: env CLANGD_FLAGS=-compile-commands-dir=no-such-dir not clangd -lit-test </dev/null 2>&1 >/dev/null | FileCheck %s
 CHECK: I[{{.*}}]{{.*}} clangd version {{.*}}
 CHECK: Working directory: {{.*}}
-CHECK: argv[0]: clangd
+CHECK: argv[0]: {{.*}}clangd
 CHECK: argv[1]: -lit-test
 CHECK: CLANGD_FLAGS: -compile-commands-dir=no-such-dir
 CHECK: E[{{.*}}] Path specified by --compile-commands-dir does not exist.
diff --git a/clang-tools-extra/test/clang-query/invalid-command-line.cpp b/clang-tools-extra/test/clang-query/invalid-command-line.cpp
index e3e8af1d5e7ae0..a66acc8037f7d9 100644
--- a/clang-tools-extra/test/clang-query/invalid-command-line.cpp
+++ b/clang-tools-extra/test/clang-query/invalid-command-line.cpp
@@ -1,4 +1,4 @@
 // RUN: not clang-query --invalid-arg 2>&1 | FileCheck %s
 
-// CHECK: error: clang-query{{(\.exe)?}}: Unknown command line argument '--invalid-arg'.  Try: 'clang-query{{(\.exe)?}} --help'
+// CHECK: error: clang-query{{(\.exe)?}}: Unknown command line argument '--invalid-arg'.  Try: '{{.*}}clang-query{{(\.exe)?}} --help'
 // CHECK-NEXT: clang-query{{(\.exe)?}}: Did you mean '--extra-arg'?
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/invalid-command-line.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/invalid-command-line.cpp
index c06b09d90004ee..4bdca50af32cac 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/invalid-command-line.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/invalid-command-line.cpp
@@ -1,4 +1,4 @@
 // RUN: not clang-tidy --invalid-arg 2>&1 | FileCheck %s
 
-// CHECK: error: clang-tidy{{(\.exe)?}}: Unknown command line argument '--invalid-arg'.  Try: 'clang-tidy{{(\.exe)?}} --help'
+// CHECK: error: clang-tidy{{(\.exe)?}}: Unknown command line argument '--invalid-arg'.  Try: '{{.*}}clang-tidy{{(\.exe)?}} --help'
 // CHECK-NEXT: clang-tidy{{(\.exe)?}}: Did you mean '--extra-arg'?
diff --git a/llvm/utils/lit/tests/shtest-output-printing.py b/llvm/utils/lit/tests/shtest-output-printing.py
index 129cff981eb5b2..b9045c3fe520bd 100644
--- a/llvm/utils/lit/tests/shtest-output-printing.py
+++ b/llvm/utils/lit/tests/shtest-output-printing.py
@@ -25,7 +25,7 @@
 #  CHECK-NEXT: not not wc missing-file &> [[FILE:.*]] || true
 #  CHECK-NEXT: # executed command: not not wc missing-file
 #  CHECK-NEXT: # .---redirected output from '[[FILE]]'
-#  CHECK-NEXT: # | wc: {{cannot open missing-file|missing-file.* No such file or directory}}
+#  CHECK-NEXT: # | {{.*}}wc: {{cannot open missing-file|missing-file.* No such file or directory}}
 #  CHECK-NEXT: # `-----------------------------
 #  CHECK-NEXT: # note: command had no output on stdout or stderr
 #  CHECK-NEXT: # error: command failed with exit status: 1



More information about the cfe-commits mailing list