test: align package fixtures with Go semantics
This commit is contained in:
@@ -26,7 +26,7 @@ categories out of the ordinary developer target.
|
||||
| Compile success/rejection, stage-routed diagnostics, and runtime exit | `test/wcc/data/*/case.ww`, executed by `wwfixture` |
|
||||
| Package semantics | `test/package` and the native package-test coordinator |
|
||||
| Language behavior | `test/lang/*_test.ww` through the language `@test` runtime |
|
||||
| Library behavior | The package coordinator's `lib/...` tree walk (`ww test -j N -I lib/ww lib/...`) |
|
||||
| Library behavior | The package coordinator's `lib/...` tree walk (`ww test -j N lib/...`) |
|
||||
| Standalone library-source compilation | Four real source paths named by `LIBRARY_STANDALONE_SOURCES`, compiled directly by both frontends |
|
||||
| Compiler-output identity | `test-lang-byteid` and `test-data-byteid` plus residual byte/artifact carriers |
|
||||
| Fixed point and self-host | `test-bootstrap` |
|
||||
@@ -192,25 +192,30 @@ and nonempty-version-constant assertions.
|
||||
## Package and language behavior
|
||||
|
||||
`ww test` delegates directory package requests to the native package
|
||||
coordinator. The coordinator owns discovery, package grouping, same-package and
|
||||
external-package test composition, filtering, result aggregation, and its
|
||||
internal temporary workspace. Test sources are exclusively `*_test.ww` (Go's
|
||||
`_test.go` contract): a line-leading `@test` declaration in any other source is
|
||||
rejected loudly — by both driver stages at directory enumeration and by the
|
||||
coordinator at source classification. A trailing `...` path element (`ww test lib/...`,
|
||||
Go's `./...` form) is recognized by both driver stages before path resolution
|
||||
and walks the tree rooted at the prefix: every subdirectory whose name does not
|
||||
begin with `.` or `_` is descended with the same lstat/no-symlink discipline,
|
||||
each test-bearing directory becomes one package run, and source-bearing
|
||||
directories without tests report the usual `?` line. The coordinator's
|
||||
`-j N` schedules up to N package groups concurrently (build-then-run
|
||||
process chains supervised with `os.exec` start/poll, no threads);
|
||||
emission stays strictly in group order, so the byte stream is identical
|
||||
at every `-j` level, and `-j 1` — the default — matches the former
|
||||
sequential loop exactly. Measured on the 31-package `lib/...` walk:
|
||||
coordinator. The coordinator owns request-pattern expansion, package grouping,
|
||||
same-package and external-package variant selection, filtering, result
|
||||
aggregation, and its internal temporary workspace. Test sources are exclusively
|
||||
`*_test.ww` (Go's `_test.go` contract): a line-leading `@test` declaration in
|
||||
any other source is rejected loudly — by both driver stages at directory
|
||||
enumeration and by the coordinator at source classification. A local spelling
|
||||
containing `...` (for example `ww test lib/...`, Go's `./...` form) is
|
||||
recognized by both driver stages before path resolution and walks from the
|
||||
directory prefix before the first wildcard. Recursive children beginning `.`
|
||||
or `_` and exact `testdata` subtrees are pruned; child directory symlinks are
|
||||
not followed. A wildcard cannot consume a non-terminal exact `vendor` element,
|
||||
while an explicitly vendor-rooted pattern remains legal. Every selected
|
||||
test-bearing directory becomes one package run, and selected source-bearing
|
||||
directories without tests report the usual `?` line. The coordinator first
|
||||
launches one driver plan for the complete command-global package/action union.
|
||||
After that shared build completes, `-j N` schedules up to N successful selected
|
||||
test binaries concurrently under `os.exec` start/poll supervision (no threads);
|
||||
emission stays strictly in group order, so the byte stream is identical at
|
||||
every `-j` level, and `-j 1` — the default — matches the former sequential
|
||||
run loop exactly. Measured on the 31-package `lib/...` walk:
|
||||
7.0s sequential, 2.4s at `-j 4`. With `-c`, it publishes each exact
|
||||
`<package>.test` binary and adjacent `<package>.test.sepwork` tree in the
|
||||
package directory; those become caller-owned artifacts. `-c -o <name>`
|
||||
`<package>.test` binary in the package directory; the first output owns the one
|
||||
shared cold sepwork containing the command-global action universe. Those become
|
||||
caller-owned artifacts. `-c -o <name>`
|
||||
names that artifact instead of the fixed stem, for exactly one package:
|
||||
the coordinator rejects a multi-package fan-out ("cannot use -o with
|
||||
multiple packages", Go's `go test -o` rule), and `-o` without `-c` is
|
||||
@@ -234,10 +239,11 @@ and make cleanup failure fail the command. Make recipes build driver-produced
|
||||
tools in invocation-owned directories and apply the same exact cleanup rule.
|
||||
|
||||
`ww build -w DIR` and single-file `ww test -w DIR` replace that scratch with a
|
||||
caller-owned persistent package-artifact workdir: the directory must already
|
||||
exist, is never cleaned by the driver, and holds one committed unit, `.wwi`,
|
||||
`.s`, `.o`, and dep `.a` per package plus byte copies of the invoking driver,
|
||||
compiler, and assembler and a small mode stamp. A package is reused only when
|
||||
caller-owned persistent package-artifact workdir: for these direct routes the
|
||||
directory must already exist, is never cleaned by the driver, and holds one
|
||||
committed unit, `.wwi`, `.s`, `.o`, and dep `.a` per package plus byte copies of
|
||||
the invoking driver, compiler, and assembler and a small mode stamp. A package
|
||||
is reused only when
|
||||
its freshly composed owner unit byte-equals the committed unit, no recompiled
|
||||
direct dependency emitted changed export bytes, and every applicable recorded
|
||||
executable byte-equals the live executable — content identity only, no mtimes,
|
||||
@@ -248,19 +254,23 @@ that neither unit bytes nor compiler identity can name.
|
||||
Recompiled artifacts land at staged `.new` names and commit by rename with the
|
||||
unit renamed last, so an interrupted build forces a recompile rather than a
|
||||
false reuse; the link always reruns. One workdir serves one invocation at a
|
||||
time and one (root, mode) shape; both driver stages implement the identical
|
||||
contract. This is build staleness in the Make/mk/Go sense, not a result cache:
|
||||
time and may hold the complete command-global action universe for all selected
|
||||
roots and isolated variants; semantic identity, rather than request shape,
|
||||
controls reuse. Both driver stages implement the identical contract. This is
|
||||
build staleness in the Make/mk/Go sense, not a result cache:
|
||||
tests always run, and the byte-identity and bootstrap gates keep building on
|
||||
fresh scratch. `make clean` reclaims every workdir under `out/`.
|
||||
|
||||
On a package or tree target, `ww test -w DIR` forwards to the coordinator,
|
||||
which keys one persistent driver workdir per package group under `DIR`
|
||||
(`<dir>_<pkg>` with `/` flattened) and passes it to each inner build; every
|
||||
reuse decision stays with the driver's content-identity contract above.
|
||||
`-w` and `-c` do not mix there — the coordinator rejects the combination
|
||||
rather than guess which artifact tree the caller owns. `test-library` uses
|
||||
exactly this: one `ww test -j $(JOBS) -w out/wwbuild/wwtest-lib -I lib/ww
|
||||
lib/...` line owns library behavior (measured: 2.3s cold, 1.0s warm at
|
||||
On a package or tree target, `ww build/test -w DIR` forwards that exact caller
|
||||
path as the one command-global semantic-action store; neither pattern spelling
|
||||
nor package-group name derives a persistent subdirectory. The delegated driver
|
||||
may create a missing store only after graph and request preflight, and rolls
|
||||
back newly created empty prefixes if later setup fails. Every reuse decision
|
||||
stays with the driver's content-identity contract above. `-w` and test `-c` do
|
||||
not mix — the coordinator rejects the combination rather than guess which
|
||||
artifact tree the caller owns. `test-library` uses exactly this: one
|
||||
`ww test -j $(JOBS) -w out/wwbuild/wwtest-lib lib/...` line owns library
|
||||
behavior (measured: 2.3s cold, 1.0s warm at
|
||||
`-j 4`, vs 4.7s for the retired 59-target per-file fan-out).
|
||||
|
||||
`test/lang` currently uses one package per source file, so its complete gate
|
||||
|
||||
Reference in New Issue
Block a user