Title: [277113] trunk/Tools
- Revision
- 277113
- Author
- [email protected]
- Date
- 2021-05-06 13:26:56 -0700 (Thu, 06 May 2021)
Log Message
Add API test for FileSystem::fileExists() on a broken symbolic link
https://bugs.webkit.org/show_bug.cgi?id=225476
Reviewed by Darin Adler.
Add API test for FileSystem::fileExists() on a broken symbolic link since this is a special
case. FileSystem::fileExists() currently tries to follow symbolic links and will thus return
false. The behavior is a little odd but I have verified that this is what our access()-based
implementation was returning also before I ported FileSystem::fileExists() to std::filesystem.
* TestWebKitAPI/Tests/WTF/FileSystem.cpp:
(TestWebKitAPI::TEST_F):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (277112 => 277113)
--- trunk/Tools/ChangeLog 2021-05-06 20:11:19 UTC (rev 277112)
+++ trunk/Tools/ChangeLog 2021-05-06 20:26:56 UTC (rev 277113)
@@ -1,3 +1,18 @@
+2021-05-06 Chris Dumez <[email protected]>
+
+ Add API test for FileSystem::fileExists() on a broken symbolic link
+ https://bugs.webkit.org/show_bug.cgi?id=225476
+
+ Reviewed by Darin Adler.
+
+ Add API test for FileSystem::fileExists() on a broken symbolic link since this is a special
+ case. FileSystem::fileExists() currently tries to follow symbolic links and will thus return
+ false. The behavior is a little odd but I have verified that this is what our access()-based
+ implementation was returning also before I ported FileSystem::fileExists() to std::filesystem.
+
+ * TestWebKitAPI/Tests/WTF/FileSystem.cpp:
+ (TestWebKitAPI::TEST_F):
+
2021-05-06 Filip Pizlo <[email protected]>
Make it easy to pass __XPC variables to run-benchmark
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp (277112 => 277113)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp 2021-05-06 20:11:19 UTC (rev 277112)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp 2021-05-06 20:26:56 UTC (rev 277113)
@@ -203,6 +203,19 @@
EXPECT_FALSE(FileSystem::fileExists(FileSystem::pathByAppendingComponent(tempEmptyFolderPath(), "does-not-exist"_s)));
}
+TEST_F(FileSystemTest, fileExistsBrokenSymlink)
+{
+ auto doesNotExistPath = FileSystem::pathByAppendingComponent(tempEmptyFolderPath(), "does-not-exist"_s);
+ auto symlinkPath = FileSystem::pathByAppendingComponent(tempEmptyFolderPath(), "does-not-exist-symlink"_s);
+ EXPECT_TRUE(FileSystem::createSymbolicLink(doesNotExistPath, symlinkPath));
+ EXPECT_FALSE(FileSystem::fileExists(doesNotExistPath));
+ EXPECT_FALSE(FileSystem::fileExists(symlinkPath)); // fileExists() follows symlinks.
+ auto symlinkMetadata = FileSystem::fileMetadata(symlinkPath);
+ ASSERT_TRUE(!!symlinkMetadata);
+ EXPECT_EQ(symlinkMetadata->type, FileMetadata::Type::SymbolicLink);
+ EXPECT_TRUE(FileSystem::deleteFile(symlinkPath));
+}
+
TEST_F(FileSystemTest, deleteSymlink)
{
EXPECT_TRUE(FileSystem::fileExists(tempFilePath()));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes