1
votes

I am facing following issues with Code coverage:

  1. The detailed html files are not generated for .cpp files which have .gcno and .gcda counterparts.
  2. gcda files automatically got deleted after running gcovr command.

I followed following steps :

  1. .gcno were generated when i compiled my code with -fprofile-arcs -ftest-coverage options and linked with -lgcov option.
  2. I ran the executable to generate the .gcda files.
  3. I copied .gcno and .gcda files to the location where i have my source code.
  4. I ran the gcovr command (mentioned below) from the top directory which have sub-directories which further contains .cpp files.
  5. The coverage.html is generated, which have information about other html reports, but when i open them they are blank.
  6. I have tried the gcovr running at various locations, like from root directory or from sub-directories.

Directory where ,gcno and .gcda files are present is :: D:\RTC_Latest_GTEST\RTC_21_11_18\software\output_gtest\Application\contents\Application_name

Directory from where gcovr command executed is :: D:\RTC_Latest_GTEST\RTC_21_11_18\software\Application\contents\Application_name

Currently i am running gcovr command from Application_name folder.

I ran the following command to generate the in depth html reports for my code :

python.exe c:\\Python27\\gcovr --exclude-unreachable-branches -b -r . -d --html --html-details -o coverage.html

Expected Results:

  1. Actual results would have the detailed coverage report in html format for each .cpp file which have corresponding .gcda and .gcno counterpart.
  2. .gcda and .gcno files would be present in the sub-directories after running gcovr command.

Generated HTML coverage report

1
Your step 3 “I copied .gcno and .gcda files to the location where i have my source code” should not be necessary – gcovr is usually able to handle out of source builds just fine. Can you try without moving the files? Btw the gcno files are deleted because you requested the -d option. Similarly, the use of the -b option is unnecessary because that only affects the (default) textual report, not the HTML report.amon

1 Answers

0
votes

-->.gcda files are getting deleted because of -d option as already told by @amon in comment.

-->Below is the command i have used for generating coverage report, i am running this command from Application_name directory::

gcovr -r .. --html --html-details -o coverage.html --object-directory=../../../..//output_gtest//Application//contents//Application_name

-->I made following modification in the command, mentioned above:

1)--object-directory ,here I added the path whre my .gcda and .gcno files are present.

2)I am using outdated version of gcovr because of which i am unable to generate coverage report, so i update my gcovr version the steps for the same is mentioned in the below link ::

https://gcovr.com/installation.html