From 06adc0d1399b73561348d9de9c5e2feba23c5d9d Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Thu, 28 May 2026 02:44:05 -0500 Subject: Reduce FUSE mutation overhead --- src/tests/test_vfs_file_ops.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/tests/test_vfs_file_ops.cpp') diff --git a/src/tests/test_vfs_file_ops.cpp b/src/tests/test_vfs_file_ops.cpp index 32b82d2..d923c41 100644 --- a/src/tests/test_vfs_file_ops.cpp +++ b/src/tests/test_vfs_file_ops.cpp @@ -81,6 +81,28 @@ TEST(VfsFileOps, CopyOnWriteFromFdCanCopyBackingSourceToDifferentDestination) EXPECT_EQ(readText(staging / "Plugin.esp"), "saved plugin"); } +TEST(VfsFileOps, CreateFileReturnsWritableStagingHandle) +{ + TempRoot tmp; + ASSERT_FALSE(tmp.path().empty()); + + const fs::path staging = tmp.path() / "staging"; + const fs::path overwrite = tmp.path() / "overwrite"; + + OverwriteManager overwriteManager(staging.string(), overwrite.string()); + std::string realPath; + const int fd = overwriteManager.createFile("ShaderCache/Lighting/test.pso", + 0600, &realPath); + ASSERT_GE(fd, 0); + + const char payload[] = "shader"; + ASSERT_EQ(write(fd, payload, sizeof(payload) - 1), ssize_t(sizeof(payload) - 1)); + close(fd); + + EXPECT_EQ(fs::path(realPath), staging / "ShaderCache/Lighting/test.pso"); + EXPECT_EQ(readText(realPath), "shader"); +} + TEST(VfsFileOps, InodeRenameMovesDescendants) { InodeTable table; -- cgit v1.3.1