Commit 1cc4c9df
1cc4c9df6a9aMerged
Ryan Seys <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
build: split test/bench compile+link to enable compiler caching
Compiler caches like sccache and ccache only cache pure compile
invocations (cc -c source.c -o out.o), not combined compile+link
calls that produce executables. The previous test rule did both in
one $(CC) call — sccache classified all 278 test compiles as
"non-compilation calls" and skipped them, leaving only the 25
build-phase compiles cached.
Splitting the rule into a compile step (cacheable) followed by a link step (uncached, but cheap) unlocks per-test caching. On warm cache, this should drop the test phase from ~3min to ~1min on unchanged tests. Same split applied to the bench rule for consistency.
Verified: all 282 tests pass with the split rule (1m02s locally).
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- 1cc4c9df6a9a
- Parent
- 60f1b75ea8d0
MakefilemodifiedView file
./spinel_parse$(EXE) "$<" "$$ast" 2>/dev/null && \ ./spinel_codegen$(EXE) "$$ast" "$$cfile" 2>/dev/null && \ $(CC) $(CFLAGS) -Werror $(SEC_FLAGS) -Ilib "$$cfile" $(SP_RT_LIB) $(LDFLAGS) -lm $(GC_FLAGS) -o "$$bin" 2>/dev/null; \ $(CC) $(CFLAGS) -Werror $(SEC_FLAGS) -Ilib -c "$$cfile" -o "$$cfile.o" 2>/dev/null && \ $(CC) $(CFLAGS) "$$cfile.o" $(SP_RT_LIB) $(LDFLAGS) -lm $(GC_FLAGS) -o "$$bin" 2>/dev/null; \ if [ $$? -eq 0 ]; then \ if [ -f "$<.expected" ]; then \ LC_ALL=C sed 's/\r$$//' "$<.expected" >"$$exp.n"; \ if [ "$$tty" = 1 ]; then printf '\r\033[K [%d/%d] %s' "$$i" "$$total" "$$bn"; fi; \ $(TIMEOUT10) ./spinel_parse$(EXE) "$$f" /tmp/_sp_b.ast 2>/dev/null && \ $(TIMEOUT10) ./spinel_codegen$(EXE) /tmp/_sp_b.ast /tmp/_sp_b.c 2>/dev/null && \ $(CC) $(CFLAGS) -Werror $(SEC_FLAGS) -Ilib /tmp/_sp_b.c $(SP_RT_LIB) $(LDFLAGS) -lm $(GC_FLAGS) -o /tmp/_sp_b_bin$(EXE) 2>/dev/null; \ $(CC) $(CFLAGS) -Werror $(SEC_FLAGS) -Ilib -c /tmp/_sp_b.c -o /tmp/_sp_b.c.o 2>/dev/null && \ $(CC) $(CFLAGS) /tmp/_sp_b.c.o $(SP_RT_LIB) $(LDFLAGS) -lm $(GC_FLAGS) -o /tmp/_sp_b_bin$(EXE) 2>/dev/null; \ if [ $$? -eq 0 ]; then \ $(TIMEOUT60) $(REF_RUBY) "$$f" >/tmp/_sp_b_exp 2>/dev/null; \ ruby_rc=$$?; \ fi; \ done; \ if [ "$$tty" = 1 ]; then printf '\r\033[K'; fi; \ rm -f /tmp/_sp_b.ast /tmp/_sp_b.c /tmp/_sp_b_bin$(EXE) /tmp/_sp_b_exp /tmp/_sp_b_act /tmp/_sp_b_exp.n /tmp/_sp_b_act.n; \ rm -f /tmp/_sp_b.ast /tmp/_sp_b.c /tmp/_sp_b.c.o /tmp/_sp_b_bin$(EXE) /tmp/_sp_b_exp /tmp/_sp_b_act /tmp/_sp_b_exp.n /tmp/_sp_b_act.n; \ echo "Benchmarks: $$pass pass, $$fail fail, $$err error, $$skip skip"; \ if [ $$fail -ne 0 ] || [ $$err -ne 0 ]; then exit 1; fi