Search code examples
qtqt-creatorbullseye

How can i setting Bullseye Code Coverage for Qt


I want to use Bullseye Code Coverage for Qt. But, I can not set the environment.(Qt creator)

I found below links and follow https://www.bullseye.com/help/tool-qtCreator.html

Bullseye Code Coverage for Qt

step1. I added below at main.pro

QMAKE_CC           = "\"C:/Program Files (x86)/BullseyeCoverage/bin/gcc\""
QMAKE_CXX          = "\"C:/Program Files (x86)/BullseyeCoverage/bin/g++\""
QMAKE_LINK         = $$QMAKE_CXX
QMAKE_LINK_C       = $$QMAKE_CC

step2. I checked the Makefile.Debug.

MAKEFILE      = Makefile.Debug

####### Compiler, tools and options

CC            = "C:/Program Files (x86)/BullseyeCoverage/bin/gcc"
CXX           = "C:/Program Files (x86)/BullseyeCoverage/bin/g++"

But step3, How can "Enable coverage build" ??

Can anyone easily explain the next steps?


Solution

  • For anyone having the same issue, the "Coverage Build" is a Bullseye option, accessible from its Tools menu (i thought it was some QtCreator's option).

    Once you have done steps 1. and 2. in the OP question:

    1. go to Bullseye and activate the Coverage Build (if you don't activate it, a normal build will be made)
    2. Compile
    3. A test.cov file should appear in the Qt project's build directory
    4. Create a COVFILE environment variable whose value is the full path to the test.cov file
    5. Restart QtCreator and rebuild

    One thing that helped troubleshooting was looking at the "Compile Output" in QtCreator. If COVFILE is correctly set, its value will be shown. If it isn't, the coverage statistics will be most likely empty.