ww: put selected toolchain first in test PATH

This commit is contained in:
2026-08-21 05:30:10 +09:00
parent 1b71250ad5
commit 9b6b1100f4
7 changed files with 586 additions and 96 deletions

View File

@@ -291,6 +291,18 @@ creates a separate process using the dependency directory. Equivalent direct,
recursive, redundant, absolute, and root-symlink spellings converge before
this runtime field is assigned.
Every test binary actually executed by either driver stage also receives one
effective uppercase `PATH` beginning with the canonical absolute directory of
the selected WW driver. Missing and empty caller values produce only that
directory; a nonempty first effective caller value follows it after `:`.
Normal duplicate `PATH=` entries collapse to the one child value. Directory
products allocate this environment independently per concurrent child; the raw
single-file route performs the same PATH transformation while retaining its
caller cwd, `PWD`, stdin, and split streams. Running retained tests transform
the private run and install only after success. Compile-only, assembly-only,
no-test, rejected, and build requests start no test process and therefore have
no test-PATH state.
Every such product also receives an independently opened null device as fd 0.
Caller terminal, pipe, and file bytes remain with the coordinator; serial and
parallel products observe immediate EOF rather than consuming a shared input
@@ -312,9 +324,10 @@ linker, support, and generated-main commands retain their build-plan cwd and
environment. Captured directory build plans begin with null stdin, which their
inherited-stdio tool descendants retain. `ww build`, `ww test -c`, `-c -o`, and
no-selected-test products start no test child. A published test binary run
directly and the raw single-file compatibility path inherit the user's
cwd/environment/stdin and contain no forced package-directory or input
behavior.
directly inherits the user's cwd/environment/stdin. The raw single-file
compatibility path inherits caller cwd/stdin and all unrelated environment
entries, with only the test-PATH transformation above; neither route embeds a
package directory or input behavior in the binary.
Before package grouping, both directory drivers and the shared recursive
coordinator apply Go 1.26.5's filename OS/architecture rule for WW's fixed
@@ -401,17 +414,20 @@ The same package owner contains the focused
independent temporary directories from an unrelated caller cwd and compares
Cstage/WWstage output for production/internal/external/combined and every
test-only shape; production and test-only dependency initialization;
recompiled external self-import; duplicate inherited `PWD`; ordinary data,
recompiled external self-import; duplicate inherited `PWD`; absent, empty,
nonempty, and duplicate inherited `PATH`; ordinary data,
`testdata`, relative writes, and deliberately nonempty caller stdin;
direct/recursive/redundant/absolute/symlink roots; reversed request and creation
order; serial and parallel products; filters, list, and no-match execution;
failure and timeout; build/no-test and compile-only paths; direct published
binaries and raw single-file execution; build-tool cwd/argv/environment/stdin;
failure and timeout; build/no-test and compile-only paths; running retained
success and failed-run rollback; direct published binaries and raw single-file
execution; build-tool cwd/argv/environment/stdin;
persistent data-only reuse and artifact bytes; input-open failure before capture
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-
product `PWD`, one toolchain-first child `PATH`, requires EOF for captured
actions and caller data for inherited-
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
@@ -520,11 +536,12 @@ real directory test products always run, while no-selected-test directories do
not create a process. The byte-identity and bootstrap gates keep building on
fresh scratch. `make clean` reclaims every workdir under `out/`.
Directory-product cwd and `PWD` are request-time child-process metadata, not
persisted action inputs or results. A runtime directory-entry failure therefore
does not erase a successfully committed compilation generation. Changing only
ordinary fixture data causes no unit/export/assembly/object/archive/main/binary
change and no producer work beyond the same established warm final relink,
Directory-product cwd, `PWD`, and test `PATH` are request-time child-process
metadata, not persisted action inputs or results. A runtime directory-entry
failure therefore does not erase a successfully committed compilation
generation. Changing only ordinary fixture data causes no
unit/export/assembly/object/archive/main/binary change and no producer work
beyond the same established warm final relink,
while the next always-run product observes the new bytes. Build workdir format
remains 18, test workdir format remains 19, and semantic storage remains 3.