Jenkins‎ > ‎

### Bullseye

Bullseye Coverage is in many cases the preferred coverage tools used in combination with C and C++. This article assumes that you are already familiar with Bullseys and that you are reading this article because you want to integrate it with Jenkins. But even if this may be your first encounter with Bullseye, it's very likely that this is all you need to know any away.

• Setup a build step that turns on Bullseye Coverage in your build step
• Converts the Bullseye coverage report to Clover format using Bullshtml
• In the post build step, pick up the (now) Clover report using the Clover plugin for Jenkins
In addition we will show you a few useful tricks for doing your covselect if you are compiling C or C++ code using IAR or KEIL compiler

First, in your Jenkins job add a build step in the build section "Add build step" -> "Execute Windows batch command"

### Dependencies

Obviously we expect that you have Bullseye Coverage installed and of course the compiler you need to use for the build. But there are a few mere dependencies you need to cover:

• Bullshtml
It's a small open source parser which will enable you to convert the Bullseye Coverage XML output to the format used by Clover (another Coverage tool, which just happens to have a well functioning Jenkins plugin, which Bullseye doesn't)
• Clover Plugin
This plugin allows you to capture code coverage reports from Clover
If you use IAR or KEIL as you compiler you should also have a look at our VANS (Validate ANy Software) project. We have made a few utilities that will enable you to do a very easy covselect simply by pointing to your project file - we'll show you later. Just get the VANS project from our Maven reporsitory: http://code.praqma.net/repo/maven/net/praqma/VANS (Current release version is 0.1.3 and you need to pick the .jar with dependencies build-in) or you can pick the latest stable version from our own Jenkins build server http://code.praqma.net/ci/job/VANS.

### A simple MSBuild example

Setup a Jenkins job and chose a "Execute Windows Batch Command" type of build, paste in the code listed below

rem /* Define the envrionment variables to use */SET MY_LOCAL_COV_FILE=%WORKSPACE%\%BUILD_NUMBER%.covSET COVFILE=%MY_LOCAL_COV_FILE%SET COVBUILDZONE=%BUILD_NUMBER%
rem /* Set directories to include and exclude - in this exmple we're adding the entire source tree*/
covselect --file "%MY_LOCAL_COV_FILE%" --add %WORKSPACE%\path\to\source\

rem /* Enable Coverage Build */
cov01 --onrem /* Execute the actual build - in this example we're using MSBuild 3.5 */
"%MS_BUILD_3_5%" /t:Rebuild /p:Configuration=Debug %WORKSPACE%\path\to\solution.sln

rem /* Disable Coverage Build */
cov01 --off

rem /* This step is the 'Jenkins Magic' where we generate the clover report using Bullshtml */
bullshtml.exe -f "%MY_LOCAL_COV_FILE%" coverage_report

The have Jenkins display the Clover report you created check the "Publish Clover Coverage Report" and type in the directory you gave as parameter to Bullshtml. The clover report is per default named clover.xml

That's it, you now get nice Coverage reports from here on.

### Validate Any Software (VAnS)

Why use VAnS as imput to bullseye? Normally we see project use one compiler for the project, and MS Visual Studio for the unittest, this could causes the above example to give more files in the measurement than we whishes. because visual studio compiles alot of different file that might not be in youre interest to measure coverage on. Therefor VAnS can be used to do the covselect on only what goes into your end project.

### IAR projects

Given that you whant to use an IAR project file you you should find all source files listet in the project file, this have we developed a utillity to do for us this is called VAnS ,
so to use this instead of the example above we will. you should remove the covselect command and replace.

so remove line

covselect --file %MY_LOCAL_COV_FILE% --add %WORKSPACE%\path\to\source\

and add theese two lines insted

java -classpath VANS-0.1.3-jar-with-dependenciews.jar net.praqma.cli.IARParse -f %WORKSPACE%\path\to\source\project.ewp -c %WORKSPACE% >> %WORKSPACE%\IARList.txt

covselect --import %workspace%\IARList.txt

### KEIL projects

Given that you whant to use an uVision project file you you should find all source files listet in the project file, this have we developed a utillity to do for us this is called VAnS ,
so to use this instead of the example above we will. you should remove the covselect command and replace.

so remove line

covselect --file %MY_LOCAL_COV_FILE% --add %WORKSPACE%\path\to\source\

and add theese two lines insted

java -classpath VANS-0.1.3-jar-with-dependencies.jar net.praqma.cli.KeilParse -f %WORKSPACE%\path\to\project.uvproj -c %WORKSPACE% >> %WORKSPACE%\KEILList.txt

covselect --import %WORKSPACE%\KEILList.txt