Commit 2b56524e

2b56524e2e0dMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified

Description

build: make test/bench targets fail loud on test errors

Both make test and make bench previously printed a summary line (Tests: N pass, M fail, K error) and exited 0 unconditionally — so CI showed SUCCESS for jobs that actually had failing tests. Several post-merge regressions slipped through master that way (e.g. the windows-mingw runner reporting 216 pass, 3 fail, 2 error and matz's local array_tally_sym cc error from gcc 13's -Walloc-size-larger-than=).

Two coupled changes:

  1. Add -Wno-alloc-size-larger-than to CFLAGS. Silences the gcc 13 paranoia warning fired on the inlined h->cap *= 2 in sp_*Hash_grow when the inliner can't bound h->cap. The pattern is bounded in practice (cap doubles from a small power of two until memory runs out, never approaches 2^60). Without this, sp_SymArray_tally — added in PR #150 — turns the warning into a -Werror failure inside make test.

  2. Both targets now exit 1 if any test fails or errors. make bench gains an explicit err counter (the loop tracked pass/fail/skip only) and reports it alongside the existing summary. The exit-1 gate makes CI's "SUCCESS" mean the job actually green-lit, not that the loop ran to completion.

After: with REF_RUBY=miniruby make test → 221 pass / 0 fail / 0 error on master locally. With default REF_RUBY=ruby on a system Ruby older than 3.3, numbered_block_params (uses Ruby 3.4+ it block param) fails loud — that's the intended strict behaviour. CI uses Ruby 3.3 which supports it; if CI's pre-existing failures (the Windows-only fileio/system tests visible in past run logs) trip the new gate, those become real bugs to fix instead of silent regressions.

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

Details

Commit
2b56524e2e0d
Parent
12f1c5c42d26

MakefilemodifiedView file

@@ -9,7 +9,13 @@
99 # make clean Remove built binaries
1010
1111 CC ?= cc
12-CFLAGS = -O2 -Wno-all
12+# `-Wno-alloc-size-larger-than` silences a gcc 13+ paranoia warning that
13+# fires on the inlined `h->cap *= 2` in sp_*Hash_grow when the inliner
14+# can't bound h->cap. The pattern is bounded in practice (cap doubles
15+# from a small power of two until memory runs out, never approaches
16+# 2^60), but gcc tracks signed-overflow UB conservatively. Other
17+# compilers don't have the warning.
18+CFLAGS = -O2 -Wno-all -Wno-alloc-size-larger-than
1319 # Bootstrap-only flags: spinel_codegen runs on the developer's machine
1420 # only, so we can use -O3 -flto for ~5-10% extra wall-clock without
1521 # constraining users (whose generated C is built with plain CFLAGS).
@@ -195,12 +201,13 @@
195201 fi; \
196202 done; \
197203 rm -f /tmp/_sp_t.ast /tmp/_sp_t.c /tmp/_sp_t_bin$(EXE); \
198- echo "Tests: $$pass pass, $$fail fail, $$err error"
204+ echo "Tests: $$pass pass, $$fail fail, $$err error"; \
205+ if [ $$fail -gt 0 ] || [ $$err -gt 0 ]; then exit 1; fi
199206
200207 bench: spinel_parse$(EXE) $(SP_RT_LIB)
201208 @if [ ! -f spinel_codegen$(EXE) ]; then echo "Run 'make bootstrap' first"; exit 1; fi
202209 @if [ -z "$(TIMEOUT_BIN)" ]; then echo "Note: no 'timeout' command found; running without time limits."; fi
203- @pass=0; fail=0; skip=0; \
210+ @pass=0; fail=0; skip=0; err=0; \
204211 for f in benchmark/*.rb; do \
205212 bn=$$(basename "$$f" .rb); \
206213 $(TIMEOUT10) ./spinel_parse$(EXE) "$$f" /tmp/_sp_b.ast 2>/dev/null && \
@@ -224,11 +231,12 @@
224231 fi; \
225232 fi; \
226233 else \
227- echo "ERR: $$bn"; \
234+ echo "ERR: $$bn"; err=$$((err+1)); \
228235 fi; \
229236 done; \
230237 rm -f /tmp/_sp_b.ast /tmp/_sp_b.c /tmp/_sp_b_bin$(EXE); \
231- echo "Benchmarks: $$pass pass, $$fail fail, $$skip skip"
238+ echo "Benchmarks: $$pass pass, $$fail fail, $$skip skip, $$err error"; \
239+ if [ $$fail -gt 0 ] || [ $$err -gt 0 ]; then exit 1; fi
232240
233241 # ---- Install ----
234242