Skip to content

effects_coro coverage is 92.78% on Linux vs ~100% on macOS: forked death tests never flush gcov under GNU ld #225

Description

@MelbourneDeveloper

Symptom

_coverage_check_c_runtime measures effects_coro.c at 92.78% on Linux and materially higher on macOS. The gate threshold is therefore pinned at 91 (raised from main's 88) rather than the 95 the macOS numbers suggested.

Cause

compiler/runtime/test_death.h flushes coverage from the forked child with:

dlsym(RTLD_DEFAULT, "__gcov_dump")

On Mach-O this resolves. Under GNU ld it returns NULL unless the executable is linked with -rdynamic / -Wl,--export-dynamic, so every death test's coverage is silently discarded on Linux. The lines those tests exercise show as uncovered even though the assertions ran and passed.

Fix

Add -rdynamic (or -Wl,--export-dynamic) to the gcov-instrumented link in the Makefile, confirm dlsym resolves in a Debian container, then ratchet effects_coro back toward 95 once the Linux measurement supports it.

Verification

Reproduce in a container:

docker run --rm -v "$PWD":/w -w /w debian:bookworm bash -c '...gcc --coverage ... && gcov ...'

Compare effects_coro.c.gcov with and without -rdynamic.

Related: #197.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions