test: port 989_lib_byteid to ww; birth test/testenv + test/byteid

test/testenv (package testenv) is the shared plumbing for ww-native
test drivers — subprocess launch with captured output, file IO, string
search, byte-sorted directory listing, scratch ownership — lifted from
the proven package_test.ww idiom; a utility, not a framework.

test/byteid/libbyteid_test.ww carries every assertion of the retired C
carrier: the 44-entry roster (fixtures + sentinel-guarded import probes
+ the zero-dep root-only build), both-stage sep builds with the
resolved-unit proof, per-package .s concat compare with the empty-concat
guard, the ID/DIVERGE/WWREJECT pin discipline, and the lib/ corpus
completeness scan (negative-verified against a planted un-enrolled
module). Concat order strengthened from shell-glob to explicit
byte-lexicographic. The roster fills by cursor-driven field writes
because append() rejects struct-call-result sources (#34).

Byteid carriers 11 -> 10; docs counts move; test-byteid runs the ww
test via the wwtest/ pattern with WW_TEST_REPO.
This commit is contained in:
2026-08-08 04:22:04 +09:00
parent cccdd6e2c8
commit cf80c603a8
5 changed files with 699 additions and 544 deletions

View File

@@ -356,7 +356,14 @@ BYTEID_WRAPPER_SOURCES = test/wcc/753_convwrap_audit.c \
test/wcc/946_structret_run.c \
test/wcc/989_m1mangle_sym.c \
test/wcc/989_m2wwi_run.c \
test/wcc/989_wwileaf_run.c test/wcc/989_lib_byteid.c
test/wcc/989_wwileaf_run.c
# Ww-native byte/artifact observers: single-file ww tests under
# test/byteid/ on the test/testenv helper package. Each drives both
# driver stages itself, so the build needs only cstage plus the two
# stage frontends it launches.
BYTEID_WW_TESTS = test/byteid/libbyteid_test.ww
BYTEID_WW_TARGETS = $(BYTEID_WW_TESTS:%=wwtest/%)
BOOTSTRAP_WRAPPER_SOURCES = test/wcc/950_selfcheck.c \
test/wcc/991_w6a_ww.c \
test/wcc/992_w6l_ww.c test/wcc/993_ww_ww.c \
@@ -455,6 +462,14 @@ $(LIBRARY_TEST_TARGETS): wwtest/%: $(BIN)/ww \
@$(BIN)/ww test -w $(WWBUILD)/wwtest/$(subst /,_,$*) \
-I $(CURDIR)/lib/ww $*
$(BYTEID_WW_TARGETS): wwtest/%: $(BIN)/ww $(BIN)/w6c $(BIN)/w6a \
$(BIN)/w6l $(LIB)/libwwrt.a $(BIN)/ww_ww $(BIN)/w6c_ww
@echo "ww test $*"
@mkdir -p $(WWBUILD)/wwtest/$(subst /,_,$*)
@WW_TEST_REPO=$(CURDIR) $(BIN)/ww test \
-w $(WWBUILD)/wwtest/$(subst /,_,$*) \
-I $(CURDIR)/test $*
test-lang: $(LANG_TEST_TARGETS)
test-library: $(LIBRARY_TEST_TARGETS) $(BIN)/w6c $(BIN)/w6c_ww \
@@ -617,7 +632,8 @@ test-data-byteid: $(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww
fi; \
exit $$rc
test-byteid: test-lang-byteid test-data-byteid test-native-byteid
test-byteid: test-lang-byteid test-data-byteid test-native-byteid \
$(BYTEID_WW_TARGETS)
# Incremental == clean. The -w reuse path must be byte-identical to a
# from-scratch build, or it is not a build-graph optimization but a
@@ -821,7 +837,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) \
$(LANG_TEST_TARGETS) $(LIBRARY_TEST_TARGETS) $(BYTEID_WW_TARGETS) \
test-data-byteid test-native-byteid test-byteid \
test-bootstrap-native test-bootstrap test-incremental \
test-platform test-all install clean bootstrap nocc bootstrap-snapshot