diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 10:50:39 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 12:35:43 -0300 |
| commit | c8ac386d8f2404417b6d09af1635e1104bcc66ae (patch) | |
| tree | dfb5dc31e454c5e7740250209b395ff981f9bc57 /test | |
| parent | d48f044458756cdf807e34842444a7fd1b01498d (diff) | |
| download | pardes-c8ac386d8f2404417b6d09af1635e1104bcc66ae.tar.gz pardes-c8ac386d8f2404417b6d09af1635e1104bcc66ae.zip | |
test: the tty harness ends a case as closing its terminal ends it: Harness.deinit closes the master first, waits on the app for up to 5 s and SIGKILLs and reaps it only after (it SIGKILLed at once and never reaped); the whole process-test on the run's own binaries under a subreaper, before and after: wall 82.7 s (load 8) against 84.7 s (load 9) and 87.4 s (load 15), the processes left 5 s after its end 1 and 1 (cmdexit's own `sleep 30`), 0 of 144 failed each time: nothing measurable, since every tty case runs without a daemon and a hangup is Killed.handle's (the terminal put back, then the signal's own death by raise), which runs no exit hook either, so a language server's group is not killed (lsp_client's killAllAtExit, an atexit) whichever way the case ends; the final tree, this change on the three before it: tui core-test 858/1009 (151 skipped), shell-test 1050/1053, term 17/17, pane 183/184, kitty 45/45, behaviour-test and --replay 275/275, process-test 0 of 144 failed, soak --clients 5 diverged 0, unequal 0, checked/wrong 1874/0 1937/0 1831/0, quiet checks 597/0 673/0 779/0, unlisted 0, corpus 22 of 22, no leak, --bytes --clients 5 diverged 0, unequal 0, corpus 22 of 22, no leak, its one unlisted stop at `now` the base's; gui unit-test 1647/1651 with only BaselineHarnessMismatch; daemon.py plain, --far, --games (keys stopped 0 and 0), --window-clients, --upgrade both ways pass; the macOS library (Linux, aarch64-macos) and FreeBSD tui build; the frame and perf gate against tree2 PASS (77 of 77 frames byte-identical, perfab corpus2x -0.039% with noise 0.080%, perfops 121 counts within 0.1%, the largest +0.0056%) (load 4-17)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test')
| -rw-r--r-- | test/e2e_harness.zig | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/e2e_harness.zig b/test/e2e_harness.zig index f7d65b03..26e942e7 100644 --- a/test/e2e_harness.zig +++ b/test/e2e_harness.zig @@ -149,9 +149,25 @@ pub const Harness = struct { return true; } + /// The app ended as closing its terminal ends it: the master closed (its + /// hangup), the app given `end_ms` to end, SIGKILLed only after, and + /// reaped: what it ends at its own end (its shells, its language servers' + /// groups) does not outlive the case. pub fn deinit(self: *Harness) void { - posix.kill(self.pid, posix.SIG.KILL) catch {}; _ = libc.close(self.master); + const end_ms = 5000; + const until = nowMs() + end_ms; + var status: c_int = 0; + var none: [0]posix.pollfd = .{}; + while (libc.waitpid(self.pid, &status, libc.W.NOHANG) == 0) { + if (nowMs() < until) { + _ = posix.poll(&none, 5) catch 0; + continue; + } + posix.kill(self.pid, posix.SIG.KILL) catch {}; + _ = libc.waitpid(self.pid, &status, 0); + break; + } self.stream.deinit(); self.gpa.destroy(self.raw); self.term.deinit(self.gpa); |
