ww test: preserve combined product output order

Go 1.26.5 maps each test binary's stdout and stderr to the same product writer. Teach the captured executor to share one open file description for byte-equal output paths, then make directory test products emit that one ordered capture on coordinator stdout. Build captures and inherited-stdio routes remain unchanged.\n\nKeep the executor mechanism, package policy, native Cstage/WWstage proof, and normative contract together so every commit preserves the observable test-output behavior.
This commit is contained in:
2026-08-20 18:29:09 +09:00
parent b996099270
commit f28843f2f5
7 changed files with 310 additions and 48 deletions

View File

@@ -248,6 +248,14 @@ parallel products observe immediate EOF rather than consuming a shared input
offset. Production and test-only dependency initialization, filters, list mode,
no-match execution, failure, and timeout use that same process boundary.
The same product maps fd 1 and fd 2 to one open product-local capture. This
matches Go's test-command use of one writer for `exec.Cmd.Stdout` and
`exec.Cmd.Stderr`: writes are not drained into two files and regrouped later.
The coordinator emits the completed combined bytes and any product run-status
line on stdout. Each parallel product has a distinct capture, while canonical
group-order emission remains byte-stable across `-j` values. Build-plan stdout
and stderr stay distinct, and loader/build diagnostics stay on stderr.
The physical directory remains distinct from exact dotted package identity and
from production, internal, external, recompiled, support, and generated-main
action identity. Only product execution uses it. Compiler, assembler, archiver,
@@ -337,7 +345,11 @@ creation; source-class rejection with empty workdirs; and deterministic
post-build child-`chdir` failure isolated from a successful sibling. It pads the
inherited environment beyond former fixed observer sizes, requires one appended
product `PWD`, requires EOF for captured actions and caller data for inherited-
stdio routes, and sweeps the persistent workdir for staged residue.
stdio routes, alternates fd-1/fd-2 write syscalls through every executing
variant and initializer, requires one ordered stdout stream on success,
assertion failure, signal, timeout, and setup failure, requires direct/raw
inherited routes to keep their streams separate, and sweeps the persistent
workdir for staged residue.
Command-global bounded-memory failure remains independently
owned by `allocation_failure_is_command_global`.
@@ -513,6 +525,10 @@ invocations are not safe to run concurrently and remain mutually exclusive.
coordinators use its captured asynchronous path. An empty captured-command
`stdinpath` opens the null device; an explicit path supplies controlled input,
and either descriptor is installed before exec with checked setup reporting.
Distinct output paths create independent exclusive captures; byte-equal output
paths open once and duplicate that descriptor so fd 1 and fd 2 share the same
open file description. The executor process proof covers both modes, including
closed caller standard descriptors.
The WW driver directly uses `os.exec.runstdio` for inherited-stdio,
inherited-environment, leader-only compiler, assembler, linker, cleanup, run,
and single-file-test calls. The local WW `procrun` implementation is deleted.