[clang] [clang][Unit Test] Updating Negative Stat Caching Diagnostic Unit Test (PR #138955)
Qiongsi Wu via cfe-commits
cfe-commits at lists.llvm.org
Wed May 7 13:37:38 PDT 2025
https://github.com/qiongsiwu created https://github.com/llvm/llvm-project/pull/138955
This PR makes a minor modification to make it more stable. The only change is adding a suffix to the path under test.
>From 1078b4a257ed1ed8d955b2041df73977fa45e3ed Mon Sep 17 00:00:00 2001
From: Qiongsi Wu <qiongsi_wu at apple.com>
Date: Wed, 7 May 2025 13:29:49 -0700
Subject: [PATCH] Fixing the unit test so that the path ends with a suffix.
---
.../DependencyScanningFilesystemTest.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
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());
}
More information about the cfe-commits
mailing list