la couverture du code pour les fichiers source en utilisant lcov
Question
J'utilise lcov et Genhtml pour générer des rapports de couverture de code. Avec la structure de répertoire suivant, je suis en mesure d'obtenir la couverture de code pour les fichiers source situés dans les tests / répertoire, mais je suis incapable d'obtenir une couverture de code pour le fichier my_file.c dans mon répertoire src /.
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
Invoquer la commande lcov à partir du répertoire des essais:
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
La solution
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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow