Skip to content

Conversation

@thirtytwobits
Copy link
Member

A much better way to generate source coverage for C++

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the C/C++ code coverage infrastructure from lcov/genhtml-based coverage to LLVM source-based code coverage, providing more accurate and modern coverage reporting capabilities.

Key Changes:

  • Replaces lcov/genhtml toolchain with LLVM's source-based coverage tools (llvm-cov and llvm-profdata)
  • Integrates CTest for test discovery and execution
  • Adds comprehensive test presets for different configurations

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
verification/cmake/utils.cmake Removes deprecated define_native_test_run function no longer needed with CTest integration
verification/cmake/modules/Findverification-coverage.cmake Completely rewritten to find LLVM coverage tools (llvm-cov, llvm-profdata) instead of lcov
verification/cmake/modules/Findgenhtml.cmake Entire file deleted as genhtml is replaced by llvm-cov for HTML report generation
verification/cmake/compiler_flag_sets/common.cmake Updates coverage compiler/linker flags to use LLVM instrumentation (-fprofile-instr-generate, -fcoverage-mapping) instead of gcov flags
verification/CMakePresetsVendorTemplate.json Changes build targets from "test_all" to "all" and removes redundant workflow metadata
verification/CMakePresets.json Changes all build targets from "test_all" to "all", removes redundant workflow display names/descriptions, adds 6 new test presets for CTest integration
verification/CMakeLists.txt Major refactoring: enables CTest, renames functions (runTestCpp→compileTestCpp, runTestC→compileTestC), removes lcov-based coverage in favor of LLVM coverage pipeline with profdata merging and multi-format report generation
CONTRIBUTING.rst Updates documentation to explain LLVM coverage workflow, output locations, and commands
.vscode/settings.json Adds SonarLint connected mode configuration
.vscode/extensions.json Removes deprecated Catch2 test adapter extension
.github/workflows/test.yml Updates coverage artifact paths and container image version to ts24.4.3
.devcontainer/toolshed-cov-arm64/devcontainer.json Entire file deleted - coverage-specific devcontainer no longer needed
.devcontainer/toolshed-cov-amd64/devcontainer.json Entire file deleted - coverage-specific devcontainer no longer needed
.devcontainer/toolshed-arm64/devcontainer.json Removes Catch2 test adapter extension
.devcontainer/toolshed-amd64/devcontainer.json Removes Catch2 test adapter extension

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI commented Dec 19, 2025

@thirtytwobits I've opened a new pull request, #386, to work on those changes. Once the pull request is ready, I'll request review from you.

Addresses feedback from #385 to use the CMake variable found by
`Findverification-coverage.cmake` instead of hardcoding the tool name.

## Changes

- Pass `LLVM_COV` to generated coverage script via `set(LLVM_COV
"${LLVM_COV}")`
- Replace hardcoded `llvm-cov` with `\${LLVM_COV}` in all
`execute_process()` commands (4 occurrences)

This matches the existing pattern for `LLVM_PROFDATA` and ensures the
build uses the tool path discovered by CMake's find_program() rather
than assuming it's in PATH.

```cmake
# Before
execute_process(
    COMMAND llvm-cov show -format=html ...
)

# After  
execute_process(
    COMMAND \${LLVM_COV} show -format=html ...
)
```

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: thirtytwobits <[email protected]>
@sonarqubecloud
Copy link

@thirtytwobits thirtytwobits merged commit 9470429 into 3.0.preview Dec 19, 2025
60 checks passed
@thirtytwobits thirtytwobits deleted the llvm-source-coverage branch December 19, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants