Qt and gcov, coverage files are not generated

后端 未结 2 1291
小蘑菇
小蘑菇 2021-01-16 04:23

I am trying to obtain code coverage for a component I am writing for the Arora browser, that is written using C++ and Qt framework.

I am not able to use the gcov pro

相关标签:
2条回答
  • 2021-01-16 04:46

    Atleast in cases where i've had similar issues, the problem has been in directory structures.

    First issue was/is that in order to generate proper .gc* files during execution, compiler cache needs to be disabled. I never really debugged the issue but now, i'd assume that the gconv files where infact placed on the compiler cache folder and during the execution of the coverage instrumented binaries, binary was not able to idenfify where new datafiles should be generated.

    Second issue is/was that i had to run the tests in the same directory structure as they where compiled in. For example, if i had compiled the application in "/home/foo/src/myproject/" and all its subdirectories .. The execution has to happen in that same directory structure or the datafiles won't get generated..

    0 讨论(0)
  • 2021-01-16 04:49

    At least you should use

    QMAKE_LFLAGS += -g -fprofile-arcs -ftest-coverage  -O0
    

    instead of

    QMAKE_LDFLAGS += -g -fprofile-arcs -ftest-coverage  -O0
    

    I'm not sure if that will fix your problem but QMAKE_LDFLAGS is not going to do anything useful.

    0 讨论(0)
提交回复
热议问题