summaryrefslogtreecommitdiff
path: root/test/process/other_files.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 10:46:54 -0300
committerGabriel Schneider <[email protected]>2026-11-05 12:41:12 -0300
commitc0b2e5d9194ce35b9fbb58d8d6e18de66cb209a8 (patch)
treefa4656b6d5e4203b8c52516d6695b8c7677de41d /test/process/other_files.zig
parent60a891ce8127c87b55aed1ff71e435cb7fbd28fc (diff)
downloadpardes-c0b2e5d9194ce35b9fbb58d8d6e18de66cb209a8.tar.gz
pardes-c0b2e5d9194ce35b9fbb58d8d6e18de66cb209a8.zip
store: Recent is a file of 200 lines under flock, written whole in place at the end of a step that changed it and read back under a session's own changes when another session wrote it since, and the panes a session closes are kept in its memory, the newest 64 within 64 MiB; the append-only CRC log with its resync and compaction, and the closed panes' self-describing dumps in it (only the session that closed one ever listed it), go; Options.store_path is recent_path ($XDG_STATE_HOME/pardes/recent), and the old store is read once while it is the newer of the two; tests: the store's four rewritten through the same windows (the 200 newest, a foreign file, a closed pane's way back from memory), the old store read once, 64 closed panes kept, recent.zig's merge; the process cases read Recent's file; docs/next-store.md is the decision
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/process/other_files.zig')
-rw-r--r--test/process/other_files.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/process/other_files.zig b/test/process/other_files.zig
index ad58dd10..17cc198c 100644
--- a/test/process/other_files.zig
+++ b/test/process/other_files.zig
@@ -7,7 +7,7 @@ pub const cases = .{
.{ "other-files: kbdin and mousein drive a detached session as the user would, each write done before it is answered", keysAndMouse },
.{ "other-files: a held connection lists a directory, stats a file, writes and reads, is refused in words and removes a pane", heldConnection },
.{ "other-files: a file opened and closed is in /recent closed, and still is in the next session; Recent's row opens it again", recentSurvivesRestart },
- .{ "other-files: two sessions share one store: a file opened in one is in the other's /recent, a Del'd pane comes back from @p only where it was", storeShared },
+ .{ "other-files: two sessions share Recent: a file opened in one is in the other's /recent, a Del'd pane comes back from @p only where it was", recentShared },
};
extern "c" fn system(cmd: [*:0]const u8) c_int;
@@ -28,9 +28,9 @@ fn removeRoot(root: []const u8) void {
_ = system(std.fmt.bufPrintSentinel(&cmd, "rm -rf -- '{s}'", .{root}, 0) catch return);
}
-fn storeExists(root: []const u8) bool {
+fn recentExists(root: []const u8) bool {
var buf: [4200]u8 = undefined;
- return std.c.access(std.fmt.bufPrintSentinel(&buf, "{s}/.local/state/pardes/store", .{root}, 0) catch return false, 0) == 0;
+ return std.c.access(std.fmt.bufPrintSentinel(&buf, "{s}/.local/state/pardes/recent", .{root}, 0) catch return false, 0) == 0;
}
/// A script types and clicks as the user does: no sleep or poll between a
@@ -111,7 +111,7 @@ fn recentSurvivesRestart(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try c.write(try std.fmt.allocPrint(a, "/pane/{d}/ctl", .{serial}), "Del\n");
try std.testing.expect(has(try c.read(a, "/recent"), try std.fmt.allocPrint(a, "closed {s}\n", .{kept})));
}
- try std.testing.expect(storeExists(root));
+ try std.testing.expect(recentExists(root));
var two = try process.Detached.start(gpa, exe, "recent2", .{ .root = root });
defer two.deinit();
const c = try process.Conn.dial(gpa, two.socket());
@@ -139,10 +139,10 @@ fn delTwice(c: *process.Conn, ctl: []const u8) !void {
c.write(ctl, "Del\n") catch try c.write(ctl, "Del\n");
}
-/// The store (Store.zig) shared with no restart; a pane Del'd in one
+/// Recent's file (Store.zig) shared with no restart; a pane Del'd in one
/// comes back where it was from a look at its @p serial there, its text
/// with it, and only there.
-fn storeShared(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
+fn recentShared(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
const a = arena.allocator();
@@ -181,5 +181,5 @@ fn storeShared(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try std.testing.expect(!has(body, "kept across a Del"));
}
}
- try std.testing.expect(storeExists(root));
+ try std.testing.expect(recentExists(root));
}