make: test-incremental gate — -w reuse must equal a clean build

Cold populate, full-skip rerun, surgical staleness (one package's
artifacts deleted), and a 0-byte .o poison drill each build the w6a
graph through a persistent workdir and must be byte-identical to a
classic fresh-scratch build, on both driver stages, plus the
cross-stage clean compare. Wired into test-all; the inner-loop targets
stay untaxed.
This commit is contained in:
2026-08-08 04:09:21 +09:00
parent 9839778f3b
commit 6148249927

View File

@@ -605,9 +605,49 @@ test-data-byteid: $(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww
test-byteid: test-lang-byteid test-data-byteid test-native-byteid
# 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
# correctness bug. Four warm shapes per driver stage — cold populate,
# full-skip rerun, surgical staleness (one package's artifacts deleted),
# and a 0-byte .o poison drill (must recompile, never reuse) — each
# compared against a classic fresh-scratch build, plus the cross-stage
# clean compare. The w6a graph keeps the gate small while covering the
# skip, recompile, commit, and legal-empty-.s (FFI-only rt) paths.
INCR_DIR = $(OUT)/incrcheck
test-incremental: $(BIN)/ww $(BIN)/ww_ww $(BIN)/w6c $(BIN)/w6c_ww \
$(BIN)/w6a $(BIN)/w6a_ww $(BIN)/w6l $(BIN)/w6l_ww \
$(LIB)/libwwrt.a
@rm -rf $(INCR_DIR)
@set -e; \
src=$(CURDIR)/selfhost/cmd/w6a/main.ww; \
inc=$(CURDIR)/selfhost/cmd/w6a; \
for stage in cs ws; do \
drv=$(CURDIR)/$(BIN)/ww; \
if [ $$stage = ws ]; then drv=$(CURDIR)/$(BIN)/ww_ww; fi; \
w=$(INCR_DIR)/$$stage.w; mkdir -p $$w; \
$$drv build -w $$w -o $(INCR_DIR)/$$stage.cold -I $$inc $$src; \
$$drv build -w $$w -o $(INCR_DIR)/$$stage.warm -I $$inc $$src; \
rm $$w/strings.s $$w/strings.o $$w/strings.a; \
$$drv build -w $$w -o $(INCR_DIR)/$$stage.surg -I $$inc $$src; \
: > $$w/bytes.o; \
$$drv build -w $$w -o $(INCR_DIR)/$$stage.heal -I $$inc $$src; \
(cd $(INCR_DIR) && $$drv build -o $$stage.clean -I $$inc $$src); \
for v in cold warm surg heal; do \
cmp $(INCR_DIR)/$$stage.$$v $(INCR_DIR)/$$stage.clean || { \
echo "test-incremental: $$stage.$$v differs from clean" >&2; \
exit 1; }; \
done; \
done; \
cmp $(INCR_DIR)/cs.clean $(INCR_DIR)/ws.clean || { \
echo "test-incremental: cstage/wwstage clean builds differ" >&2; \
exit 1; }; \
rm -rf $(INCR_DIR) || { echo "test-incremental: cleanup failed" >&2; exit 1; }; \
echo "test-incremental: -w reuse byte-identical to clean, both stages"
test-bootstrap: bootstrap test-bootstrap-native
test-all: test-commit test-byteid test-bootstrap test-platform test-wwfixture
test-all: test-commit test-byteid test-bootstrap test-platform \
test-wwfixture test-incremental
install: all
mkdir -p $(PREFIX)/bin $(PREFIX)/lib
@@ -768,5 +808,5 @@ nocc:
test test-unit test-compiler-smoke test-compiler test-package \
test-lang test-library test-commit test-lang-byteid \
test-data-byteid test-native-byteid test-byteid \
test-bootstrap-native test-bootstrap \
test-bootstrap-native test-bootstrap test-incremental \
test-platform test-all install clean bootstrap nocc bootstrap-snapshot