1

I have the .gcda and .gcno files in a folder, from which I am running the below command.

$ gcovr -r .

and the result is as below enter image description here if I run gcov on the gcda files I get the proper coverage value.

1 Answers1

5

After a tedious search in multiple forums and countless experiments, finally I figured out the issue and resolved it.

Two things are important to get the proper output from gcovr. One is from where the gcovr is executed and other is the root directory path.

gcovr should be executed from the folder where the .gcda and .gcno files exist. And the root path is the folder where the source files(.c or .cpp) exist.

With this, the command looks like something as shown below.

rr-mac:gcdaFolder$ gcovr -r /path_to_C_sourceFiles/ .

For output html file below command works

rr-mac:gcdaFolder$ gcovr --html -o Filename_rp.html -r /path_to_C_sourceFiles/ .

Note: The dot(.) at the end is mandatory

Hope this is helpful for those who are struck with this type of issue.

  • Not working for me... maybe because my test has the executable, but the source under test is at ..\..\src\ (*.C) .. the dot at the end makes no difference. – Bart Mensfort Mar 27 '18 at 11:14
  • From where you are running this command? It should be from the location where the gcda files are present. Is the first command working for you, so that you can see "*.out" file? – Rajesh Pappireddy Mar 27 '18 at 15:44