Repository navigation
Commit 4c466fc
committed
fix(build): make prod objects follow TEST_SEAMS; stop cx tmp leak
Two build/test-hygiene defects.
1. Prod vendored objects ignored TEST_SEAMS (and MEMWASTE flips)
Why: CFLAGS_PROD carries $(TEST_SEAM_DEFINE), but the objects compiled
once and linked into the product binary -- prod_lsp_all.o, the
grammars, ts_runtime -- used GRAMMAR_CFLAGS without it. A TEST_SEAMS=1
binary therefore silently lacked the seam code inside lsp_all (ts_lsp.c
budget probes), and as soon as cbm.c references a seam symbol defined
in lsp_all -- the pending DeusData#1527 change adds cbm_lsp_work_steps in
lsp/scope.c -- `make cbm TEST_SEAMS=1` fails to link, which breaks
scripts/test.sh and the smoke/_test CI builds. Adding only the define
is unsafe: none of these objects depended on $(BUILD_DIR)/.build-config,
so flipping back to TEST_SEAMS=0 would link the stale seam-built
lsp_all into a release binary. MEMWASTE had the same gap: its flags
reach every vendored prod object through MEMWASTE_VENDOR_CFLAGS.
Fix: GRAMMAR_CFLAGS carries $(TEST_SEAM_DEFINE) (as GRAMMAR_CFLAGS_TEST
already carries the define), and every prod object whose flags take a
BUILD_CONFIG_SIG variable depends on the .build-config stamp: prod_%.o,
prod_ts_runtime.o, prod_lsp_all.o, prod_preprocessor.o, prod_lz4.o,
prod_lz4hc.o, prod_zstd.o, prod_sqlite3.o, prod_tre.o. prod_mimalloc.o
and the unixcoder blob take no config variable and stay off the stamp.
Proof (macOS arm64, GNU Make 3.81):
- DeusData#1527 tree, `make cbm TEST_SEAMS=1`: undefined _cbm_lsp_work_steps
(3/3). With this Makefile it links and prod_lsp_all.o defines the
symbol; dropping only the define brings the link error back.
- main, TEST_SEAMS=1: prod_lsp_all.o had 0 seam symbols, now 1.
- Flips 1 -> 0 -> 1 -> default each recompile the 169 stamped objects
including prod_lsp_all.o; cbm_ts_lsp_test_budget_remaining in
prod_lsp_all.o and in the binary is 1/0/1/0. A repeat build at the
same config compiles and links nothing. The TEST_SEAMS=0 and default
binaries are byte-identical to the pre-change release binary.
- Revert-check: without prod_lsp_all.o's stamp prerequisite, a seams ->
release flip keeps the seam object and the release binary carries
the seam symbol (different sha256).
- Release `make cbm` before/after: byte-identical binary (sha256
048e459dfbb4...), build shown reproducible from scratch.
2. The complexity suite leaked its temp corpora
Why: cx_measure_pair and cx_measure_bigpkg_pair created
/tmp/cbm_cx_base_*, cbm_cx_dbl_*, cbm_cxbig_a_* and cbm_cxbig_b_* and
never removed them -- four dirs per run, more on failure retries.
Fix: one cx_measure() helper builds both corpora, runs the pipeline on
them and removes them with th_rmtree on success and on every failure
path, touching only the dirs it created (the temp root is shared with
concurrent runs). Only the metrics outlive the call; gates and counters
are unchanged.
Proof: /tmp listing diff around `build/c/test-runner complexity`:
+4 dirs per run before (3/3), +0 after (3/3). Injected corpus-build
failure, pipeline-run failure and assertion failure each leave +0.
Suites: complexity 5/5 (0 leaked); TEST_SEAMS=1 build of test-runner
and cbm, then complexity 5/5; make lint-ci passed.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>1 parent 1f9b4db commit 4c466fc
2 files changed
Lines changed: 71 additions & 50 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
830 | 830 | | |
831 | 831 | | |
832 | 832 | | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
833 | 839 | | |
834 | | - | |
| 840 | + | |
835 | 841 | | |
836 | 842 | | |
837 | 843 | | |
| |||
939 | 945 | | |
940 | 946 | | |
941 | 947 | | |
942 | | - | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
943 | 951 | | |
944 | 952 | | |
945 | 953 | | |
| |||
969 | 977 | | |
970 | 978 | | |
971 | 979 | | |
972 | | - | |
| 980 | + | |
973 | 981 | | |
974 | 982 | | |
975 | 983 | | |
| |||
1123 | 1131 | | |
1124 | 1132 | | |
1125 | 1133 | | |
1126 | | - | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1127 | 1142 | | |
1128 | 1143 | | |
1129 | | - | |
| 1144 | + | |
1130 | 1145 | | |
1131 | 1146 | | |
1132 | | - | |
| 1147 | + | |
1133 | 1148 | | |
1134 | 1149 | | |
1135 | | - | |
| 1150 | + | |
1136 | 1151 | | |
1137 | 1152 | | |
1138 | 1153 | | |
1139 | 1154 | | |
1140 | | - | |
| 1155 | + | |
1141 | 1156 | | |
1142 | | - | |
| 1157 | + | |
1143 | 1158 | | |
1144 | 1159 | | |
1145 | 1160 | | |
1146 | 1161 | | |
1147 | | - | |
| 1162 | + | |
1148 | 1163 | | |
1149 | 1164 | | |
1150 | 1165 | | |
| |||
1160 | 1175 | | |
1161 | 1176 | | |
1162 | 1177 | | |
1163 | | - | |
| 1178 | + | |
| 1179 | + | |
1164 | 1180 | | |
1165 | 1181 | | |
1166 | 1182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
436 | 477 | | |
437 | 478 | | |
438 | 479 | | |
439 | 480 | | |
440 | 481 | | |
441 | | - | |
442 | | - | |
443 | 482 | | |
444 | 483 | | |
445 | 484 | | |
446 | 485 | | |
447 | 486 | | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
| 487 | + | |
466 | 488 | | |
467 | 489 | | |
468 | 490 | | |
| |||
553 | 575 | | |
554 | 576 | | |
555 | 577 | | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
| 578 | + | |
| 579 | + | |
575 | 580 | | |
576 | 581 | | |
577 | 582 | | |
| |||
0 commit comments