sqlite.recipe (2484B)
1 # test/ecosystem/recipes/sqlite.recipe — real-world C build gate for SQLite. 2 # 3 # RECIPE CONTRACT (sourced by scripts/ecosystem.sh for fetch, and by 4 # test/ecosystem/run.sh for build+run). A recipe is a POSIX-sh fragment that 5 # sets the variables below and defines two functions. The harness exports 6 # $ECO_SRC (absolute path to the source root in the cache) and $ECO_DIR 7 # (absolute path to test/ecosystem) before sourcing. 8 # 9 # ECO_VERSION upstream version/tag (informational + cache key) 10 # ECO_URL pinned download URL 11 # ECO_SHA256 sha256 of the downloaded archive (provisioning is hash-gated) 12 # ECO_SRCDIR source root relative to the extracted cache entry ("." if flat) 13 # ECO_INCLUDES space-separated -I dirs, relative to the source root 14 # ECO_DEFINES extra -D flags applied to every translation unit 15 # ECO_LIBS extra link libraries (e.g. "-lm") 16 # ECO_DRIVER driver main TU: "use/<f>.c" resolves under test/ecosystem, 17 # anything else is relative to the source root (the project's 18 # own main, e.g. SQLite's shell.c) 19 # ECO_KNOWN_RED "1" if kit currently miscompiles this project (recorded xfail) 20 # 21 # eco_lib_srcs print the library's translation units (abs paths), 1/line 22 # eco_run "$APP" run the built app deterministically; stdout is the oracle 23 # 24 # Determinism rule: eco_run output must be byte-identical regardless of compiler, 25 # host RNG, time, pointer values, or hash-table iteration order. The harness 26 # diffs it against a checked-in golden AND against a clang-built reference. 27 28 ECO_VERSION=3.50.2 29 ECO_URL="https://www.sqlite.org/2025/sqlite-amalgamation-3500200.zip" 30 ECO_SHA256=387991de2834b5da2894119ff4173a9ea0779ea55ebcf53d9a40b24d1dc2484e 31 ECO_SRCDIR=sqlite-amalgamation-3500200 32 ECO_INCLUDES="." 33 ECO_DEFINES="-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION" 34 ECO_LIBS="" 35 ECO_DRIVER=shell.c 36 # Green at both -O0 and -O1 (matches clang byte-for-byte). The two historical 37 # -O1 failures are fixed: the `.Lkit_ro` one-shot-link bug 38 # (known_bugs/sqlite-o1-lkit-ro.md) and the runtime null-deref it had masked, 39 # an -O1 native-emit bitfield-store register clobber 40 # (known_bugs/sqlite-o1-runtime-segfault.md). 41 ECO_BUG="" 42 43 eco_lib_srcs() { echo "$ECO_SRC/sqlite3.c"; } 44 45 # Build the amalgamation into the stock shell and run a deterministic SQL 46 # script through it (batch mode; piped stdin suppresses the interactive banner). 47 eco_run() { "$1" ":memory:" < "$ECO_DIR/scripts/sqlite.sql"; }