summaryrefslogtreecommitdiff
path: root/test/tty.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 09:10:24 -0300
committerGabriel Schneider <[email protected]>2026-11-21 09:10:24 -0300
commitc4f7bb9477c7aa4c8864f14edb9e85b6c8c08437 (patch)
tree9b60bce9e53f96855b40f2ba53e23945a7798ddf /test/tty.zig
parentf7de6f49ee3d9ac241575f5244743193c9943841 (diff)
parent5ad6067936f306271b875aaf182d4866055da10d (diff)
downloadpardes-c4f7bb9477c7aa4c8864f14edb9e85b6c8c08437.tar.gz
pardes-c4f7bb9477c7aa4c8864f14edb9e85b6c8c08437.zip
integration: the pair's round 5 and the layers' round 2 on the gathered line: pardes-pair-5 (`ssrtxkzx`, on pardes-merge48: a link an Upgrade cuts with no last word asks the daemon whether its session is listed still and joins again (`replica.cutListed`): an upgrade from the installed build carries its clients; a no-daemon pair refuses Restore in words (P42); /dev/tty opened before the pair forks; a TERMed or hung-up client dies of the signal; the process suite as pairs 13 to 8 of 145) and pardes-layers-2 (`myxnnquu`, on pardes-merge49: the click on path@rev tested, a revision read-only from 9P, Syntax off in a patch keeps the patch's colours); no conflict; core-test 893/1053 (160 skipped), shell-test 1095/1098; its gate: .scratch/sketch/reorg/merge50, the numbers in PARDES.md (2026-11-21)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/tty.zig')
-rw-r--r--test/tty.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/tty.zig b/test/tty.zig
index f26328ca..5cd92887 100644
--- a/test/tty.zig
+++ b/test/tty.zig
@@ -58,6 +58,10 @@ pub var replay_with: ?[]const u8 = null;
const base_dir = "/tmp/pardes-snap";
const gpa = std.heap.page_allocator;
+/// The runner's own runtime directory while a case has one of its own
+/// (`Tty.privateDaemon`).
+var runtime_dir: ?[*:0]const u8 = null;
+
pub const Tty = struct {
arena: std.mem.Allocator,
exe: [:0]const u8,
@@ -139,6 +143,24 @@ pub const Tty = struct {
pub fn deinit(t: *Tty) void {
if (t.h) |*h| h.deinit();
+ // Set back, not unset: an unsetenv compacts the environment block
+ // the runner's std.Io holds (host_io.testUnsetenv's reason).
+ if (runtime_dir) |was| {
+ _ = setenv("PARDES_HARNESS_DAEMON", "", 1);
+ _ = setenv("XDG_RUNTIME_DIR", was, 1);
+ runtime_dir = null;
+ }
+ }
+
+ /// Under PARDES_PAIR, the pair started next has a daemon of its own, in
+ /// the case's directory as its runtime directory (never the user's): a
+ /// Restore lets its client go, and it joins again through it, as with a
+ /// user's daemon. `deinit` puts the runtime directory back.
+ pub fn privateDaemon(t: *Tty) void {
+ if (std.c.getenv("PARDES_PAIR") == null) return;
+ runtime_dir = std.c.getenv("XDG_RUNTIME_DIR") orelse return;
+ _ = setenv("XDG_RUNTIME_DIR", t.arena.dupeSentinel(u8, t.base, 0) catch return, 1);
+ _ = setenv("PARDES_HARNESS_DAEMON", "1", 1);
}
/// The captures against the golden, or written to it under `--update`.