RFC: Deeper code coverage profiling with Twister test automation #67058
Labels
area: Code Coverage
area: Continuous Integration
area: Twister
Twister
Enhancement
Changes/Updates/Additions to existing features
RFC
Request For Comments: want input from the community
Introduction
Twister tool supports dynamic code coverage profiling on test execution; it also generates human readable reports in various formats.
Currently this Twister feature provides less data than it is possible to achieve effectively on a CI pipeline 'at scale' for precise code profiling, test planning and gap analysis.
The resulting code coverage report might be also misleading without its test scope context.
This proposal is to extend Twister in two aspects:
Problem description
Proposed change
twister.json
as additional properties of its test suite run together with the test results.Detailed RFC
The new
--coverage-split
mode extends Twister code coverage operations to report coverage statistics on each test instance configuration run individually in addition to the currently supported (default) reporting mode which aggregates data into a singlereport summarizing results of all the tests in the current scope of the Twister run.
The split mode allows to identify precisely what amount of code coverage each test case configuration provides and to analyze its contribution to the overall test plan's coverage.
Each build directory will have its own coverage report and data files, so the overall disk space and the total execution time increase.
The split mode reads the raw data files while the test jobs are running in parallel, so the report aggregation stage doesn't need to do the same at its turn.
Another new
--disable-coverage-aggregation
option allows to execute only the--coverage-split
mode when the summary statistics are not needed.New Twister option
--coverage-sections
allows to select what coverage data to include into thetwister.json
file for its further analysis in addition to the test meta-data and the test results.The choices are to select either the coverage summary, or the detailed branch coverage, ztest coverage, or all the coverage data collected.
Also the coverage run 'status' and coverage 'tool' values are added with any non-default choice. The 'environment' top object has additional 'gcov_tool' property to keep the command line argument selection.
Depending on
--coverage-split
and--disable-coverage-aggregation
options the coverage data is attached either to its test suite object or/and at the report's top level as the aggregated summary of the test plan execution scope.Proposed change (Detailed)
see #66345 in review with the proposed Twister extension.
Dependencies
The change should not affect any CI validation pipeline which uses Twister, unless the new reporting features are enabled explicitly.
With the new options enabled gradually (split aggregation, selected extra json sections) more data will be collected eventually increasing twister.json size and additional coverage reports.
The overall time for Twister to execute the same test plan on the same host(s) will also grow, although with better workload distribution - Twister will process GCOV output as parallel jobs instead of doing it once at the final report generation, as currently.
Concerns and Unresolved Questions
twister.json
is fully supported only for the defaultgcovr
reporting tool as it depends on gcovr capability. Forlcov
reporter the coverage run status is only added.twister.json
sections; to visualize it with Kibanait needs custom Vegastandart charts. More details on this with an example script to upload the new code coverage data.Alternatives
The text was updated successfully, but these errors were encountered: