foundry icon indicating copy to clipboard operation
foundry copied to clipboard

lcov version 2.1 breaks coverage report

Open 0xernesto opened this issue 1 week ago • 0 comments

Component

Forge

Have you ensured that all of these are up to date?

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (c8db1e4 2024-06-27T00:18:32.026850000Z)

What command(s) is the bug in?

forge coverage --report lcov && genhtml lcov.info -o report --branch-coverage

Operating System

macOS (Apple Silicon)

Describe the bug

When trying to generate an HTML coverage report based on the lcov.info that forge coverage --report lcov outputs, the following error occurs:

Wrote LCOV report.
lcov: ERROR: (inconsistent) "src/MyContract.sol":49:  function MyContract. found on line but no corresponding 'line' coverage data point.  Cannot derive function end line.  See lcovrc man entry for 'derive_function_end_line'.
 (use "lcov --ignore-errors inconsistent ..." to bypass this error)

This problem happens if you install lcov using Homebrew on MacOS, which currently installs lcov version 2.1.

When downgrading to lcov version 1.16, this problem goes away.

To reproduce error:

brew install lcov
forge coverage --report lcov && genhtml lcov.info -o report --branch-coverage

To get around the error: Downgrade lcov to version 1.16.

0xernesto avatar Jun 27 '24 23:06 0xernesto