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:
64
Makefile
64
Makefile
@@ -482,35 +482,12 @@ wwtest/test/tool/ffivariadic_test.ww: $(OUT)/ffivariadic/libffifix.a
|
||||
|
||||
# Native library tests execute their source owner directly. The retired C
|
||||
# launchers added no assertion beyond this exit status.
|
||||
LIBRARY_TESTS = lib/errors/errno_test.ww lib/ascii/ascii_test.ww \
|
||||
lib/ww/syntax/tok_test.ww lib/ww/syntax/ast_test.ww \
|
||||
lib/ww/syntax/sym_test.ww \
|
||||
lib/strconv/test/ftos_test.ww lib/strconv/test/stof_test.ww \
|
||||
lib/strconv/test/int_test.ww lib/strings/strings_test.ww \
|
||||
lib/strings/suffix_test.ww lib/strings/contains_test.ww \
|
||||
lib/strings/index_test.ww lib/strings/compare_test.ww \
|
||||
lib/bytes/equal_test.ww lib/bytes/index_test.ww \
|
||||
lib/bytes/contains_test.ww lib/bytes/tokenize_test.ww \
|
||||
lib/bytes/trim_test.ww lib/encoding/utf8/rune_test.ww \
|
||||
lib/encoding/utf8/encode_test.ww lib/encoding/utf8/decode_test.ww \
|
||||
lib/encoding/utf8/types_test.ww \
|
||||
lib/bufio/stream_test.ww lib/bufio/scanner_test.ww \
|
||||
lib/math/random/random_test.ww \
|
||||
lib/math/checked/checked_test.ww lib/fmt/fmt_test.ww \
|
||||
lib/log/funcs_test.ww lib/log/global_test.ww \
|
||||
lib/log/silent_test.ww lib/fnmatch/fnmatch_test.ww \
|
||||
lib/shlex/shlex_test.ww lib/time/arithm_test.ww \
|
||||
lib/time/duration_test.ww lib/time/instant_test.ww \
|
||||
lib/encoding/hex/hex_test.ww lib/memio/memio_test.ww \
|
||||
lib/temp/temp_test.ww lib/getopt/getopt_test.ww \
|
||||
lib/encoding/base32/base32_test.ww \
|
||||
lib/encoding/base64/base64_test.ww \
|
||||
lib/hash/adler32/adler32_test.ww lib/hash/crc16/crc16_test.ww \
|
||||
lib/hash/crc32/crc32_test.ww lib/hash/crc64/crc64_test.ww \
|
||||
lib/path/buffer_test.ww lib/path/posix_test.ww \
|
||||
lib/path/stack_test.ww lib/crypto/sha256/sha256_test.ww \
|
||||
lib/hash/siphash/siphash_test.ww \
|
||||
lib/os/os_test.ww lib/os/stat_test.ww lib/dirs/dirs_test.ww
|
||||
# Library behavior has ONE owner: the package coordinator's lib/...
|
||||
# tree walk in test-library (Go's `go test ./...` — the PACKAGE, not
|
||||
# the file, is the unit of testing; same-package *_test.ww compose
|
||||
# into one unit). No per-file registration exists: a new lib
|
||||
# *_test.ww is discovered by the walk, and the libbyteid completeness
|
||||
# scan still fails loudly on any unenrolled lib/ dir.
|
||||
|
||||
# These real sources have a standalone-compilation contract that is not
|
||||
# subsumed by a library @test import owner.
|
||||
@@ -541,13 +518,12 @@ test-compiler: $(WWFIXTURE_BIN) $(WRAPPER_TOOLS) $(COMPILER_WRAPPER_BINS) \
|
||||
echo "compiler artifact $$t"; BIN=$(CURDIR)/$(BIN) $(CURDIR)/$$t; \
|
||||
done
|
||||
|
||||
# One phony target per language/library test file so `make -jN`
|
||||
# parallelizes the suites, each in its own persistent -w workdir so only
|
||||
# changed packages rebuild. Tests always execute — the workdir caches
|
||||
# builds, never results.
|
||||
# One phony target per language test file so `make -jN` parallelizes
|
||||
# the suite, each in its own persistent -w workdir so only changed
|
||||
# packages rebuild. Tests always execute — the workdir caches builds,
|
||||
# never results.
|
||||
LANG_TEST_FILES = $(wildcard test/lang/*_test.ww)
|
||||
LANG_TEST_TARGETS = $(LANG_TEST_FILES:%=wwtest/%)
|
||||
LIBRARY_TEST_TARGETS = $(LIBRARY_TESTS:%=wwtest/%)
|
||||
|
||||
$(LANG_TEST_TARGETS): wwtest/%: $(BIN)/ww \
|
||||
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a
|
||||
@@ -555,13 +531,6 @@ $(LANG_TEST_TARGETS): wwtest/%: $(BIN)/ww \
|
||||
@mkdir -p $(WWBUILD)/wwtest/$(subst /,_,$*)
|
||||
@$(BIN)/ww test -w $(WWBUILD)/wwtest/$(subst /,_,$*) $*
|
||||
|
||||
$(LIBRARY_TEST_TARGETS): wwtest/%: $(BIN)/ww \
|
||||
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a
|
||||
@echo "ww test $*"
|
||||
@mkdir -p $(WWBUILD)/wwtest/$(subst /,_,$*)
|
||||
@$(BIN)/ww test -w $(WWBUILD)/wwtest/$(subst /,_,$*) \
|
||||
-I $(CURDIR)/lib/ww $*
|
||||
|
||||
$(BYTEID_WW_TARGETS): wwtest/%: $(BIN)/ww $(BIN)/w6c $(BIN)/w6a \
|
||||
$(BIN)/w6l $(BIN)/wwdump $(LIB)/libwwrt.a \
|
||||
$(BIN)/ww_ww $(BIN)/w6c_ww
|
||||
@@ -640,16 +609,19 @@ $(TOOL_WW_TARGETS): wwtest/%: $(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
|
||||
|
||||
test-lang: $(LANG_TEST_TARGETS)
|
||||
|
||||
test-library: $(LIBRARY_TEST_TARGETS) $(BIN)/w6c $(BIN)/w6c_ww \
|
||||
$(WWTEST_BIN) $(LIBRARY_STANDALONE_SOURCES)
|
||||
test-library: $(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
|
||||
$(LIB)/libwwrt.a $(BIN)/w6c_ww $(WWTEST_BIN) \
|
||||
$(LIBRARY_STANDALONE_SOURCES)
|
||||
@set -e; for f in $(LIBRARY_STANDALONE_SOURCES); do \
|
||||
echo "library compile c $$f"; \
|
||||
$(CURDIR)/$(BIN)/w6c $(CURDIR)/$$f > /dev/null; \
|
||||
echo "library compile ww $$f"; \
|
||||
$(CURDIR)/$(BIN)/w6c_ww $(CURDIR)/$$f > /dev/null; \
|
||||
done
|
||||
@echo "ww test lib/regex"
|
||||
@$(CURDIR)/$(BIN)/ww test lib/regex
|
||||
@echo "ww test -j $(JOBS) lib/..."
|
||||
@mkdir -p $(WWBUILD)/wwtest-lib
|
||||
@$(CURDIR)/$(BIN)/ww test -j $(JOBS) -w $(WWBUILD)/wwtest-lib \
|
||||
-I $(CURDIR)/lib/ww lib/...
|
||||
|
||||
test-bootstrap-native: $(WRAPPER_TOOLS) $(BOOTSTRAP_WRAPPER_BINS)
|
||||
@set -e; for t in $(BOOTSTRAP_WRAPPER_BINS); do \
|
||||
@@ -1000,7 +972,7 @@ nocc:
|
||||
.PHONY: all cstage wwstage wwfixture test-wwfixture-process test-wwfixture \
|
||||
test test-unit test-compiler-smoke test-compiler test-package \
|
||||
test-lang test-library test-commit test-lang-byteid \
|
||||
$(LANG_TEST_TARGETS) $(LIBRARY_TEST_TARGETS) $(BYTEID_WW_TARGETS) \
|
||||
$(LANG_TEST_TARGETS) $(BYTEID_WW_TARGETS) \
|
||||
$(SEP_WW_TARGETS) test-data-byteid test-byteid \
|
||||
test-bootstrap-native test-bootstrap test-incremental \
|
||||
test-platform test-all install clean bootstrap nocc bootstrap-snapshot
|
||||
|
||||
Reference in New Issue
Block a user