Commit 22daacf5

22daacf58b37Merged

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

Description

fix: stabilize make bench with timeouts and proper skip detection

  • Add timeout to spinel_parse/codegen (10s) to prevent hangs on unsupported benchmarks (e.g. bm_app_lc_fizzbuzz lambda calculus)
  • Detect Ruby timeout via exit code 124 instead of empty output check, fixing false skips for benchmarks with no output (bm_so_lists)
  • 38 benchmarks pass, 1 fail (bm_splay runtime bug)

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

Details

Commit
22daacf58b37
Parent
7b83ba73df11

MakefilemodifiedView file

@@ -106,26 +106,31 @@
106106 echo "Tests: $$pass pass, $$fail fail, $$err error"
107107
108108 bench: spinel_parse spinel_codegen build/sp_bigint.o $(RE_LIB)
109- @pass=0; fail=0; \
109+ @pass=0; fail=0; skip=0; \
110110 for f in benchmark/*.rb; do \
111111 bn=$$(basename "$$f" .rb); \
112- ./spinel_parse "$$f" /tmp/_sp_b.ast 2>/dev/null && \
113- ./spinel_codegen /tmp/_sp_b.ast /tmp/_sp_b.c 2>/dev/null && \
112+ timeout 10 ./spinel_parse "$$f" /tmp/_sp_b.ast 2>/dev/null && \
113+ timeout 10 ./spinel_codegen /tmp/_sp_b.ast /tmp/_sp_b.c 2>/dev/null && \
114114 $(CC) $(CFLAGS) /tmp/_sp_b.c build/sp_bigint.o $(RE_LIB) -lm -o /tmp/_sp_b_bin 2>/dev/null; \
115115 if [ $$? -eq 0 ]; then \
116116 expected=$$(timeout 60 ruby "$$f" 2>/dev/null); \
117- actual=$$(timeout 60 /tmp/_sp_b_bin 2>/dev/null); \
118- if [ "$$expected" = "$$actual" ]; then \
119- pass=$$((pass+1)); \
117+ ruby_rc=$$?; \
118+ if [ $$ruby_rc -eq 124 ]; then \
119+ echo "SKIP: $$bn (ruby timeout)"; skip=$$((skip+1)); \
120120 else \
121- echo "FAIL: $$bn"; fail=$$((fail+1)); \
121+ actual=$$(timeout 60 /tmp/_sp_b_bin 2>/dev/null); \
122+ if [ "$$expected" = "$$actual" ]; then \
123+ pass=$$((pass+1)); \
124+ else \
125+ echo "FAIL: $$bn"; fail=$$((fail+1)); \
126+ fi; \
122127 fi; \
123128 else \
124129 echo "ERR: $$bn"; \
125130 fi; \
126131 done; \
127132 rm -f /tmp/_sp_b.ast /tmp/_sp_b.c /tmp/_sp_b_bin; \
128- echo "Benchmarks: $$pass pass, $$fail fail"
133+ echo "Benchmarks: $$pass pass, $$fail fail, $$skip skip"
129134
130135 # ---- Install ----
131136