Test-only deterministic fault injection for the crash/hang supervisor tests. * Gated entirely behind env vars that are never set in production; a matching * rel_path either aborts (a fault signal the supervisor classifies as a crash) * or spins forever (an external-scanner infinite loop the quiet-timeout kills). * This gives an honest guard — green iff the supervisor actually contains a real
| 576 | * unlucky in-flight file is never quarantined alone. The env var is set |
| 577 | * solely by the supervisor during recovery — a no-op on normal runs. */ |
| 578 | static void cbm_index_mark(const char *rel_path, char event) { |
| 579 | const char *mf = getenv("CBM_INDEX_MARKER_FILE"); |
| 580 | if (!mf || !mf[0] || !rel_path || !rel_path[0]) { |
| 581 | return; |
| 582 | } |
| 583 | FILE *f = cbm_fopen(mf, "ab"); |
| 584 | if (f) { |
| 585 | (void)fprintf(f, "%c %s\n", event, rel_path); |
| 586 | (void)fclose(f); |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | void cbm_index_mark_start(const char *rel_path) { |
| 591 | cbm_index_mark(rel_path, 'S'); |
no test coverage detected