-
Notifications
You must be signed in to change notification settings - Fork 362
sonar.cxx.bullseye.reportPaths
Sensor to read reports from the BullseyeCoverage tool. BullseyeCoverage is an advanced C++ code coverage tool used to improve the quality of software in vital systems such as enterprise applications, industrial control, medical, automotive, communications, aerospace and defense. BullseyeCoverage supports a wide range of platforms.
The BullseyeCoverage XML report contains the condition/decision coverage (probe element) and the statement/block coverage (block element). The sensor only evaluates the probe element to be backward compatible.
- The condition/decision coverage can be mapped directly to the condition coverage supported by SonarQube.
- The line coverage is calculated indirectly, which causes a slight deviation of the metric between the tools.
Note: The cxx plugin itself does not run the tool, you have to do that yourself beforehand. The sensor only reads the report generated by the tool!
- Link to the tool page: https://www.bullseye.com/
- The sensor supports coverage reports from BullseyeCoverage with XML version 6 (https://www.bullseye.com/help/ref-covxml.html).
In order to run BullseyeCoverage and generate a fitting report, make sure:
- to call it from the projects root directory, so that the paths in the report fit
- that the parameter matches the
sonar.sources
list insonar-project.properties
cov01 enables, disables, and displays the current status of BullseyeCoverage compiler interceptors for the current user. When coverage build is enabled, compiler interceptors pass control to covc. When coverage build is disabled, compiler interceptors pass control to the real compiler with the same name as the compiler interceptor.
covc compiles C/C++ source files after adding coverage measurement probes. covc preprocesses each source file, adds probes to the preprocessed code, then compiles it using the real compiler. The coverage file is created if it does not exist. An entry is created in the coverage file for each source file processed. The coverage file, named test.cov by default, contains all BullseyeCoverage data for all instrumented executables.
cov01 -1
cc -c source.c
covc cc -c source.c
Convert the resulting coverage file into an XML file
Use covxml to create a XML coverage report:
covxml -f coverage.cov -o coverage.xml
covmerge combines metadata and measurements in each of the coverage files input.cov into a result coverage file. You can use this command to combine measurements obtained when testing a program on separate computers with separate copies of a coverage file.
covmerge -c coverage1.cov coverage2.cov -f result.cov
If the tool was executed successfully, a report like the example below should be generated (https://www.bullseye.com/help/ref-covxml.html):
<?xml version="1.0" encoding="UTF-8"?>
<!-- BullseyeCoverage XML 8.20.2 Windows x64 -->
<BullseyeCoverage name="coverage.cov" dir="root" buildId="745ae38_2020-11-09_19:52:34" version="6" xmlns="https://www.bullseye.com/covxml"
fn_cov="1" fn_total="1" cd_cov="0" cd_total="0" d_cov="0" d_total="0">
<folder name="folder" fn_cov="1" fn_total="1" cd_cov="0" cd_total="0" d_cov="0" d_total="0">
<src name="test.cpp" mtime="1604936026" fn_cov="1" fn_total="1" cd_cov="0" cd_total="0" d_cov="0" d_total="0">
<fn name="Core::TokenHandler::~TokenHandler()" fn_cov="1" fn_total="1" cd_cov="0" cd_total="0" d_cov="0" d_total="0">
<probe line="3" column="7" kind="function" event="full"/>
<block line="3" entered="1"/>
</fn>
</src>
</folder>
</BullseyeCoverage>
- First check if the file extensions read in by the cxx plugin are set (sonar.cxx.file.suffixes).
- Set the analysis parameter
sonar.cxx.bullseye.reportPaths
in the configuration filesonar-project.properties
of your project. The Report Paths link describes the configuration options. - Execute the SonarScanner to transfer the project with the report to the SonarQube Server.
Sample for sonar-project.properties:
sonar.cxx.bullseye.reportPaths=coverage.xml
- Read the general hints to Troubleshooting Coverage.
- If scanning is failing, check items listed under Troubleshooting Configuration.
- If no issues are displayed for your source code in SonarQube, check the items listed under Troubleshooting Reports.
- In the case of incomplete scans, Detect and fix parsing errors gives advice on how to fix this.