resist
resist

Reputation: 1

cant create coverage informations with lcov WARNING: no .gcda files found in ./coverage

I have been trying to get code coverage working for Qt but im struggling with generating any coverage information

  1. Project
    example.pro (contains include for googletest.pri)
    • gtest_dependency (contains googletest.pri
      • headerfiles for gtest
        testsuite.h
        sourcefiles for gtest
        test.cpp
        testsuite.cpp
    • main.cpp
      All files above are pretty much empty just the code to run the test and one test case.

I included the linker flags in the example.pro

QMAKE_CXXFLAGS += -O0 -g --coverage 
QMAKE_LFLAGS += -O0 -g --coverage

The problem is when I build the project it creates all the .gcna .gcno files, but when i execute lcov it says

WARNING: no .gcda files found in ./coverage -skipping!
Finished .info-file creation
Reading tracefile ./coverage/coverage.info
lcov: ERROR: no valid records found in tracefile ./coverage/coverage.info
Reading data file ./coverage/coverage-filtered.info
genhtml: ERROR: cannot read file ./coverage/coverage-filtered.info

Qt Version 5.14.2
Compiler mingw730_64
lcov version 1.14
gcov version 7.5.0

Upvotes: 0

Views: 1345

Answers (1)

resist
resist

Reputation: 1

Ok i managed to fix it
If you run into the same problem as me check if you have googletest installed on /usr/include, since I use lcov and so on over the linux bash it couldnt find anything since everything was installed over /mnt/ and it couldnt find gtest since it searches in /usr.
Same goes for qt it couldnt find the files even if included with -L and -I.
I had to install both on /usr/

Upvotes: 0

Related Questions