[clang-tools-extra] [clang-doc] [test] Generalize error message patterns (PR #142373)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 2 05:29:21 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: Martin Storsjö (mstorsjo)
<details>
<summary>Changes</summary>
On Windows, we hit the "no such file or directory" case, not the "Not a directory" one.
MS STL produces the "no such file or directory" message for `std::error_code(ENOENT, std::generic_category()).message()`, while libc++ and libstdc++ produce a similar message with a capital N.
Adjust the error message regex to match for either of them.
That said, this kind of test is very brittle with respect to portability.
---
Full diff: https://github.com/llvm/llvm-project/pull/142373.diff
1 Files Affected:
- (modified) clang-tools-extra/test/clang-doc/invalid-options.cpp (+1-1)
``````````diff
diff --git a/clang-tools-extra/test/clang-doc/invalid-options.cpp b/clang-tools-extra/test/clang-doc/invalid-options.cpp
index c8a4cef8364eb..59a0944718e31 100644
--- a/clang-tools-extra/test/clang-doc/invalid-options.cpp
+++ b/clang-tools-extra/test/clang-doc/invalid-options.cpp
@@ -2,7 +2,7 @@
// RUN: rm -rf %t && touch %t
// RUN: not clang-doc %s -output=%t/subdir 2>&1 | FileCheck %s --check-prefix=OUTPUT-FAIL
// OUTPUT-FAIL: clang-doc error:
-// OUTPUT-FAIL: {{(Not a directory|no such file or directory)}}
+// OUTPUT-FAIL: {{(Not a directory|[Nn]o such file or directory)}}
/// Invalid format option.
// RUN: rm -rf %t && mkdir %t && touch %t/file
``````````
</details>
https://github.com/llvm/llvm-project/pull/142373
More information about the cfe-commits
mailing list