Files
codebase-memory-mcp/tests
Martin Vogel 6b25fff3a1 test(harness): coverage runner profiles children that leave through _exit
The profile runtime writes from an atexit handler, and the children that do
the real work of a test never reach it: a fork that hosts a whole MCP server
leaves through _exit(), and the re-exec'd index worker leaves through
_Exit(), as the production worker does. Measured on
mcp:index_bg_paths_route_through_supervisor_issue832 with the hooks as first
written, neither of its two children left a profile and the test mapped to
the 19 functions its parent ran. A test-impact map built on that would never
select the test for a pipeline change.

In the coverage build only (CBM_TEST_COVERAGE, POSIX), the runner image now
defines _exit and _Exit to write the profile before calling the libc one, so
every call in the image is covered: tests, runner roles and product code. A
pthread_atfork child handler gives a forked child the profile name an exec'd
child derives from LLVM_PROFILE_FILE, so it cannot write over the profile of
its parent. The same test now leaves both child profiles and maps to 1530
functions, 1511 of them executed only in a child.

A child that dies by signal still leaves no profile, and none of this is
compiled into any other build: the ASan runner has no symbol from it.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-01 23:04:50 +02:00
..