test: library behavior owned by the coordinator lib/... walk

Go has no per-file test targets: the PACKAGE is the unit of testing
(`go test ./...`) and same-package test files compose together. The
59-target LIBRARY_TESTS fan-out (per-file -w workdirs, one Make rule
per suite) collapses to one line: `ww test -j $(JOBS) -w
out/wwbuild/wwtest-lib -I lib/ww lib/...` — the regex dir-route
precedent generalized. The lib/regex line and the per-file pattern
rule instance dissolve with it (test/lang keeps its own rule).

Measured before committing (-j4, strings edit row): old per-file
warm 4.7-4.9s; bare walk 5.2-5.6s — a real regression, so the
coordinator first gained the brief's persistent per-package workdir:
`-w DIR` on a package target forwards to wwpackage, which keys
DIR/<dir>_<pkg> per group and hands it to each inner `ww test -c`
build. Reuse stays entirely with the driver's existing
content-identity contract — the coordinator adds pure path policy,
no cache machinery. Both driver stages drop their package-target -w
rejects (forward instead); -w with -c stays rejected at the
coordinator (two ownership contracts). After: 3.9-4.0s on the edit
row, 1.0s warm no-op, 2.5s cold — faster than the old flow on every
row.

package_test's tree -w reject row becomes the positive contract
(cold+warm byte-stable stream, cs/ww same) plus the -c conflict
reject. libbyteid roster shape DECIDED: per-file fx entries stay —
every enrolled file is still standalone-buildable, so coverage is
byte-for-byte unchanged; the dir-mode entry form arrives only with
the B3 shared-helper split that first needs it. Docs: owner table,
target table, -w contract paragraph.
This commit is contained in:
2026-08-08 19:35:50 +09:00
parent 0ecdf75a0d
commit 5a263cb115
6 changed files with 115 additions and 80 deletions

View File

@@ -1708,16 +1708,13 @@ do_test(int argc, char **argv)
"ww test: -o needs -c for a package target\n");
return 2;
}
if (workdir[0]) {
fprintf(stderr,
"ww test: -w needs a single test file\n");
return 2;
}
if (pattern) {
fprintf(stderr,
"ww test: pattern needs a single test file\n");
return 2;
}
/* -w forwards: the coordinator keys one persistent driver
* workdir per package group under the given root. */
return exec_package_tests(argc, argv, src, NULL, 0);
}
struct stat st;
@@ -1742,11 +1739,6 @@ do_test(int argc, char **argv)
"ww test: -o needs -c for a package target\n");
return 2;
}
if (workdir[0]) {
fprintf(stderr,
"ww test: -w needs a single test file\n");
return 2;
}
if (pattern) {
fprintf(stderr,
"ww test: pattern needs a single test file\n");
@@ -1882,10 +1874,6 @@ do_test(int argc, char **argv)
fprintf(stderr, "ww test: -o needs -c for a package target\n");
return 2;
}
if (workdir[0]) {
fprintf(stderr, "ww test: -w needs a single test file\n");
return 2;
}
/* The second bare positional remains the legacy single-file filter form;
* package filtering uses explicit -run/-filter options. */
if (pattern) {