Skip to content

test(host): serialize the pty-heavy terminal capacity tests - #1607

Merged
huichen merged 1 commit into
mainfrom
pr/huichen
Nov 14, 2026
Merged

huichen merged 1 commit into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

A test-infrastructure fix for the future-host terminal tests. The macOS host-core job failed once in terminal::manager::tests::global_capacity_is_enforced_across_conversations with openpty: … code: 6 (ENXIO). ENXIO there is the machine-wide PTY table, not an fd budget (an fd limit reports EMFILE): macOS serves kern.tty.ptmx_max ptys (511, failing at the 505th), and cargo test runs test functions in parallel, so the four capacity/retention tests overlapping asked the OS for roughly 95 ptys at once while the whole suite was also holding sessions.

The tests keep their full demand — every one still creates its quota and proves the refusal past it — and simply take turns on a pty_heavy_guard() mutex for the duration of their body. Measured on an idle machine: the terminal module's peak falls from 115 to 58 live ptys, the whole future-host core suite from 116 to 63.

Commits

  • test(host): serialize the pty-heavy terminal capacity tests

Verification

Local, in a detached worktree at a0b24949e, pinned toolchain rustc 1.99.1, ulimit -n 8192, CARGO_TARGET_DIR=<repo>/target:

  • cargo fmt -p future-host -- --check → clean
  • cargo clippy -p future-host --all-targets -- -D warnings → clean
  • cargo test -p future-host --lib → 2249 passed, 0 failed, 15 ignored (457.6 s)

Notes

No assertion, #[ignore], timeout or lint allowance was changed. The guard is taken as a named binding (let _heavy = …) so it lives for the whole test body, and it recovers from a poisoned lock so one panicking test cannot fail every later one.

User-visible changes

none — test-only change under host/src/terminal/.

The macOS host-core job failed once with

  terminal::manager::tests::global_capacity_is_enforced_across_conversations
  create session: Spawn("SPAWN_FAILED: openpty: ... code: 6")

ENXIO here is the machine-wide pty table, not an fd budget (which reports
EMFILE): macOS serves kern.tty.ptmx_max ptys (511; openpty starts failing at
the 505th) and cargo test runs test functions in parallel, so the four
capacity/retention tests overlapping asked the OS for ~95 ptys at once, three
or four application instances' worth, while a single FutureOS process can only
hold MAX_SESSIONS.

The tests keep their full demand, they just take turns, so the terminal
module's peak falls from 115 to 58 live ptys (four test threads).
@huichen
huichen enabled auto-merge (squash) November 14, 2026 01:26
@huichen
huichen merged commit b338eba into main Nov 14, 2026
21 checks passed
@huichen
huichen deleted the pr/huichen branch November 14, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant