apple / apple/containerization
Add a test target covering vmexec Console.configureStdIO
- Dominant language
- Swift
- Stars
- 8.9k
- Forks
- 359
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 13
Description
## Problem
The regression test added for the pty raw-mode fix (apple/container#1148) validates the pre-existing `Terminal.setraw()` recipe at the ContainerizationOS level, but never exercises the changed production code path `vminitd/Sources/vmexec/Console.swift` `configureStdIO()`. A regression in the production wiring (e.g. removal of the setraw() call) would pass the macOS test suite.
## Why it matters
`Console.configureStdIO()` is Linux-only (the `vmexec` executable target in the `vminitd` package) and the `vminitd` package declares zero test targets today. The 1024-byte stdout truncation it fixes is Linux-kernel tty behavior that macOS `openpty` cannot reproduce, so the truncation regression is unguarded by automation.
## Suggested fix
Add a Linux-target test (or CI step) that runs `Console.configureStdIO()` on a pty pair and writes >1024 bytes through the slave, asserting full delivery on the master. Keep the macOS termios-flag assertions as fast recipe-level coverage.
## Evidence
- `vminitd/Sources/vmexec/Console.swift:63: try Terminal(descriptor: slaveFD, setInitState: false).setraw()`
- `Tests/ContainerizationOSTests/TerminalRawModeTests.swift:63: try child.setraw()`
- `vminitd/Package.swift` declares no testTarget for vmexec
## Source
Branch `fix/pty-raw-mode-interactive-stdout` at head `9ed4b36` in apple/containerization (worktree).
## Metadata
Severity: P2
Confidence: 100
Reviewer(s): correctness, testing
Finding ID: vminitdsourcesvmexecconsole.swift63-regressiontestdoesnotexercisetheproductioncodepathconsoleconfigurestdioitismeanttoprotect
Contributor guide
Research direction
Start with vminitd/Package.swift and vminitd/Sources/vmexec/Console.swift, especially configureStdIO(), then compare the existing coverage in Tests/ContainerizationOSTests/TerminalRawModeTests.swift. The work is done when a Linux-target test exercises the production path on a pty and verifies that more than 1024 bytes reach the master without replacing the macOS termios assertions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, swift
- Domain
- operating-systems, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100