Ecosystem gate — building real-world C with kit
This suite proves kit can compile, archive, link, and run real upstream C projects, and that the results match a reference clang build byte-for-byte.
It is intentionally a differential, reproducible gate:
- Reproducible — sources are pinned upstream releases (URL + sha256) fetched into the kit cache dir, never vendored into the repo. Provision once with network access; the gate then runs fully offline against the cache.
- Real usage — each project is built the way it is actually consumed: every
translation unit is compiled with
kit cc, archived into a static library withkit ar, and a driver (the project's own shell/interpreter, or a smalluse/<name>.c) is linked against it and executed. - Differential — the program's deterministic output is asserted two ways:
against a checked-in golden (
expected/<name>.txt) and against the same program built with the hostclang(the differential oracle). - Both opt levels — every project runs at
-O0and-O1.
Run it
make provision-ecosystem # fetch + verify + extract pinned sources (network)
make test-ecosystem # build with kit + clang, run, diff (offline)
Or directly, with finer control:
scripts/ecosystem.sh status # what's provisioned
scripts/ecosystem.sh fetch sqlite # fetch one project
test/ecosystem/run.sh sqlite lua # run only these
KIT_TEST_OPTS=O0 test/ecosystem/run.sh # one opt level
test/ecosystem/run.sh --update # refresh goldens (from clang)
Projects
| project | what the driver exercises |
|---|---|
| sqlite | shell built from the amalgamation runs SQL: joins, aggregates, CTEs, window functions, JSON |
| lua | ~30-TU static lib + interpreter runs a script: GC, closures, coroutines, string.format, integer/float |
| cJSON | parse / navigate / build / serialize JSON |
| lz4 | block compress/decompress round-trips |
| miniz | deflate/inflate round-trips + CRC-32 / Adler-32 |
| tinyexpr | expression compile + variable binding |
| yyjson | read / navigate / mutate / write JSON |
Adding a project
Drop a recipes/<name>.recipe (contract documented in recipes/sqlite.recipe):
pin ECO_URL + ECO_SHA256, point ECO_SRCDIR at the source root, define
eco_lib_srcs and eco_run, and add a driver under use/ if the project has no
suitable main. Then scripts/ecosystem.sh fetch <name> and
test/ecosystem/run.sh --update <name> to seed the golden.
Known bugs (kept red on purpose)
Failures are not xfailed or worked around — see known_bugs/. The gate stays
red until they are fixed, and each failing build's artifacts are preserved under
build/ecosystem-fail/ for investigation.