aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-05-28 02:44:05 -0500
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-05-28 02:44:05 -0500
commit06adc0d1399b73561348d9de9c5e2feba23c5d9d (patch)
tree1a3c67cc5845c9e616fd759549f851c596708fd8 /src/tests
parent07ac26ba1ca08f430bd5faae89b98d5b2704c5de (diff)
Reduce FUSE mutation overhead
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_vfs_file_ops.cpp22
1 files changed, 22 insertions, 0 deletions
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;