Testing
The test suite is CTest over the build tree. Every test carries exactly one cost label, so a run selects work by what it costs rather than by which directory the source happened to land in.
| label | meaning |
|---|---|
quick |
no large model; seconds to about a minute |
model |
loads a test model (a real GGUF, or the image model) |
long |
over five minutes |
The labels are assigned at registration in tests/core/CMakeLists.txt, the out-of-tree suites’ CMake files and bindings/guile/CMakeLists.txt; boom_add_cpp_test defaults a C++ test to quick and the model and long suites override it where they are declared. Four suites are long: test_spec_invariance, test_capi_spec_decode, test_prefill_effects_identity and test_prefill_split_last. The four documentation tests keep their historical docs label as a second label, so ctest -L docs still selects them.
Running
ctest --test-dir build -L quick -j1 --output-on-failure # fast, per change
ctest --test-dir build -L model -j1 --output-on-failure # model-driven suites
ctest --test-dir build -L long -j1 --output-on-failure # over five minutes
ctest --test-dir build -LE long -j1 --output-on-failure # quick + modelModel tests locate their files through four environment variables and skip (CTest return code 77) when a file is unset or absent:
export SONICBOOM_GEMMA_GGUF=/path/to/gemma-4-E4B-it-Q5_K_M.gguf
export SONICBOOM_QWEN_GGUF=/path/to/qwen2.5-7b-instruct-1m-q4_k_m.gguf
export SONICBOOM_QWEN7B_GGUF=/path/to/qwen2.5-7b-instruct-1m-q4_k_m.gguf
export SONICBOOM_QWEN36_GGUF=/path/to/Qwen3.6-35B-A3B-Q4_K_M.ggufTests that allocate device memory take a CTest resource lock, and several suites share a process-global tuning/compile cache that is only isolated within one test process. Run the suite with -j1: parallel test processes contend for the device and can observe each other’s cache state.
test_spec_invariance walks 441 verify-vs-decode cases and takes about an hour. SONICBOOM_SPEC_INVARIANCE_SAMPLE=N runs only the cases whose enumeration index modulo N is 0 — a deterministic 1/N subsample of the same ordered (model, depth, k) walk, with no randomness. Unset (the default) runs every case. The round driver’s --part sets it to 10; --final leaves it unset, so the closing gate still checks all 441 cases.
Test economy
- During a change, run the
quicklabel and the suites that cover the touched paths. Run the full suite once, at the end of the work, not after every edit. - Timed runs (benchmarks, the full suite) hold
/tmp/sb-bench.lock; never run two timed jobs at once. Untimed test runs need no lock. - The full suite runs against a fresh copy of a frozen tuning snapshot (
SONICBOOM_TUNE_DIR=<copy>,SONICBOOM_TUNE_QUIET=off) so a golden does not depend on live tuning. Records missing for kernels added later are tuned on first use and then live only in that run’s copy. - Archived performance baselines are measured once per toolchain and read, not rebuilt, by the tools that compare against them (
SONICBOOM_BASELINE_ARCHIVEpoints at the archive directory). The tools refresh a baseline only when the driver or toolkit differs from the archive’s recorded conditions, or the spec-off decode rate drifts more than 3% with no decode-path change.
Out-of-tree suites
A build can add engine-internal suites from outside this repository by setting SONICBOOM_PRIVATE_TESTS_DIR to a directory with its own CMakeLists.txt. Those suites register into the same build and CTest run and reuse boom_add_cpp_test. The round-level driver that selects tests from a diff, reads the baseline archive and runs the closing benchmarks lives with those out-of-tree suites; the public tree carries the tests and the labels, not the private data they may read.
Goldens
Numerics goldens — output bytes, token ids, logits, hashes — are recorded reference behaviour and are never re-recorded, and a test is never changed to make one pass. Structural goldens (graph and plan shape) may be updated only alongside a stated structural change, and the diff must contain exactly that change.
Quality CI
tools/quality/run.sh ci runs the tests, the sanitizer builds and the static checks, and prints one PASS/FAIL line per sub-check. A report quotes every sub-check by name rather than a single overall result.