From 40d82949f56b198e6d351a3cbd95b9a7bfb2323f Mon Sep 17 00:00:00 2001 From: Martin Vogel Date: Tue, 7 Jul 2026 01:55:27 +0200 Subject: [PATCH] fix(test): faithful _Exit in the harness index worker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The supervised-worker fast path deliberately skips the pipeline teardown (the OS reclaims the process wholesale) and pairs that with _Exit, which bypasses atexit/LeakSanitizer. The production worker in run_cli has both halves; the test binary's worker emulation (tf_maybe_run_index_worker) only had the first: it returned normally through main(), LeakSanitizer ran at exit, reported the intentionally unfreed pipeline and forced exit code 1 — so the supervisor read a healthy index as worker_failed and IDX832 went red on exactly the platforms whose ASan builds run a leak pass (all four Linux legs; macOS/Windows ASan have none). Reproduced and verified fixed in an ubuntu:22.04 arm64 container: reap outcome=clean, mcp suite 140/0. Mirror the production exit: deliver the response file, fflush, _Exit. Signed-off-by: Martin Vogel --- tests/test_main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_main.c b/tests/test_main.c index aeae0492..67ba5df3 100644 --- a/tests/test_main.c +++ b/tests/test_main.c @@ -75,10 +75,18 @@ static int tf_maybe_run_index_worker(int argc, char **argv) { (void)fclose(rf); } } - free(result); } - cbm_mcp_server_free(srv); - return 0; + /* Faithful worker exit: mirror run_cli's supervised-worker fast path. + * The worker-role pipeline deliberately skips its teardown (the OS + * reclaims everything wholesale on process death), so a normal return + * through main() lets LeakSanitizer run at exit, report the + * intentionally-unfreed pipeline, and force exit code 1 — the + * supervisor then reads a HEALTHY index as worker_failed (the + * Linux-only IDX832 red: LSan is active in Linux gcc ASan builds, + * absent on macOS/Windows). _Exit skips atexit/LSan by design, + * exactly like the production worker in run_cli. */ + fflush(NULL); + _Exit(result ? 0 : 1); } /* #798 follow-up: socket-isolation probe. The parent test