[clang] [clang][Unit Test] Updating Negative Stat Caching Diagnostic Unit Test (PR #138955)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 7 13:38:09 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Qiongsi Wu (qiongsiwu)

<details>
<summary>Changes</summary>

This PR makes a minor modification to make it more stable. The only change is adding a suffix to the path under test.  

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


1 Files Affected:

- (modified) clang/unittests/Tooling/DependencyScanning/DependencyScanningFilesystemTest.cpp (+4-4) 


``````````diff
diff --git a/clang/unittests/Tooling/DependencyScanning/DependencyScanningFilesystemTest.cpp b/clang/unittests/Tooling/DependencyScanning/DependencyScanningFilesystemTest.cpp
index 5ea8d02353dc3..aed793785f7b1 100644
--- a/clang/unittests/Tooling/DependencyScanning/DependencyScanningFilesystemTest.cpp
+++ b/clang/unittests/Tooling/DependencyScanning/DependencyScanningFilesystemTest.cpp
@@ -186,12 +186,12 @@ TEST(DependencyScanningFilesystem, DiagnoseStaleStatFailures) {
   DependencyScanningFilesystemSharedCache SharedCache;
   DependencyScanningWorkerFilesystem DepFS(SharedCache, InMemoryFS);
 
-  bool Path1Exists = DepFS.exists("/path1");
+  bool Path1Exists = DepFS.exists("/path1.suffix");
   EXPECT_EQ(Path1Exists, false);
 
   // Adding a file that has been stat-ed,
-  InMemoryFS->addFile("/path1", 0, llvm::MemoryBuffer::getMemBuffer(""));
-  Path1Exists = DepFS.exists("/path1");
+  InMemoryFS->addFile("/path1.suffix", 0, llvm::MemoryBuffer::getMemBuffer(""));
+  Path1Exists = DepFS.exists("/path1.suffix");
   // Due to caching in SharedCache, path1 should not exist in
   // DepFS's eyes.
   EXPECT_EQ(Path1Exists, false);
@@ -200,5 +200,5 @@ TEST(DependencyScanningFilesystem, DiagnoseStaleStatFailures) {
       SharedCache.getInvalidNegativeStatCachedPaths(*InMemoryFS.get());
 
   EXPECT_EQ(InvalidPaths.size(), 1u);
-  ASSERT_STREQ("/path1", InvalidPaths[0].str().c_str());
+  ASSERT_STREQ("/path1.suffix", InvalidPaths[0].str().c_str());
 }

``````````

</details>


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


More information about the cfe-commits mailing list