Skip to content

gcovr filtering steps #47

@sdarwin

Description

@sdarwin

It looks like Claude over-simplified.

In build.sh there are multiple steps:

# Pass 1: Collect raw coverage as JSON
gcovr --merge-mode-functions separate -p \
    --merge-lines \
    --exclude-unreachable-branches \
    --exclude-throw-branches \
    --exclude '.*/test/.*' \
    --exclude '.*/extra/.*' \
    --filter "$GCOVRFILTER" \
    --json "$outputlocation/coverage-raw.json"

# Fix paths in JSON
python3 "../scripts/fix_paths.py" \
    "$outputlocation/coverage-raw.json" \
    "$outputlocation/coverage-fixed.json" \
    --repo "$REPONAME"

# Create symlinks so gcovr can find source files at repo-relative paths
ln -sfn "$BOOST_CI_SRC_FOLDER/include" "$(pwd)/include" 2>/dev/null || true
ln -sfn "$BOOST_CI_SRC_FOLDER/src" "$(pwd)/src" 2>/dev/null || true

# Pass 2: Generate HTML from fixed JSON
gcovr -a "$outputlocation/coverage-fixed.json" \
    --html-nested \
    --no-html-self-contained \
    --html-template-dir=../templates/html \
    --html-title "$REPONAME" \
    --html \
    --output "$outputlocation/index.html" \
    --json-summary-pretty \

Which --options must be included in each steps?

It seems "--merge-lines" must also be in Pass 2. It's missing. Otherwise the reports overcount lines.

And (possibly but uncertain) "--merge-mode-functions separate" also. Just to be safe.

"Pass 2" appears twice in build.sh so modifications should be done in multiple places.

@julioest

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