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

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


Author: Paul Kirth
Date: 2025-05-23T11:47:20-07:00
New Revision: 524ef164a745a364f80c11c9a8ddb58321ed408f

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

LOG: [clang-doc] Avoid reading files in unit tests (#141269)

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

Added: 
    

Modified: 
    clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp

Removed: 
    


################################################################################
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.";
 }
 


        


More information about the cfe-commits mailing list