2

I am using lcov and genhtml to generate code coverage reports. With the following directory structure, I am able to get the code coverage for the source files located in the tests/ directory, but am unable to get code coverage for the my_file.c file in my src/ directory.

src/
   my_file.c
   my_file.h
tests/
   AllTests.c
   CuTest.c
   CuTest.h
   my_file_tests.c

   objects/
       AllTests.gcda
       AllTests.gcno
       AllTests.o
       CuTest.gcda
       CuTest.gcno
       CuTest.o
       my_file.gcda
       my_file.gcno
       my_file.o
       my_file_tests.gcda
       my_file_tests.gcno
       my_file_tests.o

Invoking the lcov command from the tests directory:

lcov -b . --directory objects/ -c -o ./coverage/app.info

Capturing coverage data from objects/
Found gcov version: 4.4.3
Scanning objects/ for .gcda files ...
Found 4 data files in objects/
Processing objects/AllTests.gcda
Processing objects/my_file_test.gcda
Processing objects/CuTest.gcda
Processing objects/my_file.gcda
geninfo: WARNING: gcov did not create any files for /home/me/workspace/project/tests/objects/my_file.gcda!
Finished .info-file creation

1 Answer 1

3

Upgrading from lcov 1.7 to 1.9 fixed this issue for me. Version 1.9 is available from http://ltp.sourceforge.net/coverage/lcov.php

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.