Everything you need to know about code coverage in C++ Xavier Bonaventura and Jorge Pinto Sousa
HTML-код
- Опубликовано: 21 ноя 2024
- Code coverage is one of the metrics to be considered when you want to deliver high quality software. At the same time, having 100% code coverage does not guarantee you anything.
In this talk we will explain why you should consider code coverage and what does it mean and does not mean to reach 100%. We will talk about baseline coverage, the different types of code coverage, and what is required by the ISO 26262 standard used in automotive.
We will also get into the typical code coverage workflow, tracing the journey from raw source code through the process of instrumentation. We'll explore the types of data collected, as well as the intermediate files produced during this phase.
Our exploration will include a review of various coverage tools, specifically gcov, gcovr, lcov, and llvm-cov, and we'll examine their connection to the Abstract Syntax Tree (AST).
Additionally, we will highlight several corner case scenarios, including:
Branches introduced by compiler optimizations
The implications of const, constexpr, and consteval
Templates