UNDER THE HOOD
Tests and gates
- Unit tests (
unittests/, GoogleTest).LibrarySpecTest.cpp(WeaveCCoreTests) checks every library entry against an independent, hand-written expectation table.GuardPassTest.cpp(WeaveCFrontendTests) runs the guard passes on IR text, each removal rule alone, and checks the IR and the ledger rows they leave. - The runtime test (
runtime/test/rt_test.c, CTestruntime) is one C program linked withlibweavec_rt.aandlibweavec_alloc.a, so itsmallocis the arena’s. It tests the shadow and its encoding, the size classes, alignment, reallocation, the sweep (recycling, retention, following the heap, stopping threads, pacing, the C library’s data through the image table), invalid releases (in child processes that must die), huge blocks, foreign pointers, the guards, strings, the checked calls, globals, dynamic allocas and the stack’s unpoisoning, ASan’s interface, the number parsers and limits, mappings, the array-bounds handlers, threads andfork. Test names as arguments run only those. - Lit tests (
test/Guards,test/Driver) pin exact output and behaviour.test/Guardspins the passes’ IR (FileCheck on-emit-llvm:ir-*.c, among themir-frames.c, andshared-frame.c) and, by building and running programs, the run-time behaviour, each report line, and the enforcement ledger;test/Driverpins the runtime’s link line and fallbacks (runtime-*.c), fortification (fortify.c), ASan’s macros (asan-compat*.c) and the globals of a dylib and a bundle (image-globals.c). test/casesis one tree of executable C cases by feature, with expectations as line-comment markers (see its README).scripts/run-cases.pybuilds each case withweavec-cc(GUARDED,PROVEN,UNGUARDEDandEXPECT-LEDGERon the enforcement ledger) and runs it, attributing every stop to a line and a kind (TRAP: <kind>,TRAP-AT: <unit>:<line>, andSTOPin aDETECTcase).test/cases/determinismholds a bug per class RFC 0036 makes deterministic, each with its correct twin (gate G1), and, asXFAIL, the bugs it leaves to a later RFC.--asanadds an oracle built with-fsanitize=address,array-bounds;--checks verifyfails anyweavec.provenreport. CTest registers onecases-<suite>test per top-level directory, soctest -jruns the suites in parallel.test/corpuspins real projects, built and tested withweavec-ccbyscripts/corpus-gate.py(--quickon every pull request); see its README.
RFC 0036’s acceptance gates (detection G1–G3, drop-in G4–G5, cost G6–G9,
hygiene H1–H2) are measured with these tools. scripts/check-hygiene.py
implements gate H1: no libc name comparisons outside the library table, no
corpus project named under lib/, Core free of Clang and LLVM, the
runtime’s includes, its entry points declared in weavec_rt.h, and the
line budgets of the library (9,000) and of the runtime (6,000).
scripts/codegen-identity.py checks that
objects built with -fweavec-checks=none are byte-identical to Clang’s.