kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit 5c0845b9c3a5d4033bf3b849a2cd31559f798cdf
parent a5649e0b9c21f6f3e66ace447ee0048f9d315f7f
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Tue,  2 Jun 2026 08:25:24 -0700

test: rename bootstrap-test-toy -> test-bootstrap-toy, add to default test targets

Move the self-hosted toy-corpus run into test.mk under the conventional test-*
name, register it in TEST_TARGETS (.PHONY) and DEFAULT_TEST_TARGETS so `make
test` runs it, and update the doc references. It runs the Toy corpus through the
bootstrapped stage3 cfree, exercising the self-built compiler on real codegen
beyond `make bootstrap`'s self-reproduction check.

make test parses (make -n test exit 0); make test-bootstrap-toy 1355/0.

Diffstat:
MMakefile | 4----
Mdoc/BUILD.md | 2+-
Mdoc/TESTING.md | 2+-
Mdoc/plan/BOOTSTRAP.md | 2+-
Mtest/test.mk | 10+++++++++-
5 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile @@ -429,7 +429,6 @@ DIST_TARBALL = build/dist/cfree.tar.gz bootstrap-debug \ bootstrap-release \ _do-bootstrap \ - bootstrap-test-toy \ bench-opt all: lib bin @@ -567,9 +566,6 @@ $(BOOTSTRAP_STAMP): $(BIN) $(BOOTSTRAP_RT_LIBS) $(BOOTSTRAP_MAKEFILES) shasum -a 256 $(BOOTSTRAP_STAGE2_BIN) $(BOOTSTRAP_STAGE3_BIN) @touch $@ -bootstrap-test-toy: bootstrap-debug - @CFREE='$(abspath $(BUILD_DIR)/debug/bootstrap/stage3/cfree)' test/toy/run.sh - bench-opt: $(MAKE) RELEASE=1 bin @CFREE='$(abspath build/release/cfree)' bash scripts/opt_bench.sh diff --git a/doc/BUILD.md b/doc/BUILD.md @@ -258,7 +258,7 @@ on the deterministic output above) catches any non-reproducible codegen. The bootstrap drives the *normal* Makefile with `CC`/`AR`/`LD` repointed at the stage's symlinks, so there is no separate "bootstrap build" — it is the same build rules run with cfree as the toolchain. `make bootstrap` runs both the debug -and release chains; `make bootstrap-test-toy` additionally runs the Toy corpus +and release chains; `make test-bootstrap-toy` additionally runs the Toy corpus through the bootstrapped compiler. The host-clang seed is the current root of trust. A full diverse-double-compilation diff --git a/doc/TESTING.md b/doc/TESTING.md @@ -389,7 +389,7 @@ The check is `cmp stage2/cfree stage3/cfree` — byte-identical binaries (and th recipe also compares every `.o`). If stage2 mis-compiles any part of cfree, the two stages diverge, so this exercises a very large slice of the language, the ISA, the optimizer, the assembler, the linker, and the object writers at once, on -real code rather than test fixtures. `bootstrap-test-toy` additionally runs the +real code rather than test fixtures. `test-bootstrap-toy` additionally runs the full Toy corpus through a bootstrapped compiler to confirm it not only reproduces but works. The diagnostic discipline that makes a bootstrap divergence tractable is to compare a single stage2-compiled object against the host compiler's output diff --git a/doc/plan/BOOTSTRAP.md b/doc/plan/BOOTSTRAP.md @@ -31,7 +31,7 @@ Driving targets (see [../BUILD.md](../BUILD.md)): - `make bootstrap` runs both the debug (`-O0`) and release (`-O1`) chains. - `make bootstrap-debug` / `make bootstrap-release` run one chain. -- `make bootstrap-test-toy` additionally runs the Toy corpus through the +- `make test-bootstrap-toy` additionally runs the Toy corpus through the bootstrapped compiler as a behavioral check on top of the byte-identity check. ## Current baseline diff --git a/test/test.mk b/test/test.mk @@ -48,6 +48,7 @@ TEST_TARGETS = \ test-hostas-toy \ test-hostas-cross \ test-diff-llvm \ + test-bootstrap-toy \ test-bounce \ test-cbackend \ test-cg-api \ @@ -152,7 +153,8 @@ DEFAULT_TEST_TARGETS = \ test-link-x64 \ test-rt-runtime \ test-bounce \ - bootstrap + bootstrap \ + test-bootstrap-toy .PHONY: test $(TEST_TARGETS) @@ -394,6 +396,12 @@ test-native-direct-target: $(NATIVE_DIRECT_TARGET_TEST_BIN) test-toy: bin @CFREE=$(abspath $(BIN)) test/toy/run.sh +# test-bootstrap-toy: run the Toy corpus through the bootstrapped (self-built) +# stage3 cfree instead of the host-built binary, so the self-hosted compiler is +# exercised on real codegen (not just self-reproduction like `make bootstrap`). +test-bootstrap-toy: bootstrap-debug + @CFREE='$(abspath $(BUILD_DIR)/debug/bootstrap/stage3/cfree)' test/toy/run.sh + # Public-API inline-asm backend tests. These emit a tiny function through CG, # reopen the object through the public object reader, and assert the expected