[clang-tools-extra] [clang-doc] Avoid reading files in unit tests (PR #141269)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 23 11:04:38 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Paul Kirth (ilovepi)

<details>
<summary>Changes</summary>

In #<!-- -->138062 it was brought up that this was an anti-pattern. We'll need
to Migrate all of the mustache unittests to lit tests, and disable them
until tool support lands.

---
Full diff: https://github.com/llvm/llvm-project/pull/141269.diff


1 Files Affected:

- (modified) clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp (+4-2) 


``````````diff
diff --git a/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp b/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
index 70491f0754b3d..4c8cf4fa7e460 100644
--- a/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
+++ b/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
@@ -91,10 +91,12 @@ TEST(HTMLMustacheGeneratorTest, generateDocs) {
   unittest::TempDir RootTestDirectory("generateDocsTest", /*Unique=*/true);
   CDCtx.OutDirectory = RootTestDirectory.path();
 
-  getMustacheHtmlFiles(CLANG_DOC_TEST_ASSET_DIR, CDCtx);
+  // FIXME: We can't read files during unit tests. Migrate to lit once
+  // tool support lands.
+  // getMustacheHtmlFiles(CLANG_DOC_TEST_ASSET_DIR, CDCtx);
 
   EXPECT_THAT_ERROR(G->generateDocs(RootTestDirectory.path(), {}, CDCtx),
-                    Succeeded())
+                    Failed())
       << "Failed to generate docs.";
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/141269


More information about the cfe-commits mailing list