2011-06-15 117 views
1

我正在使用lcov和genhtml生成代碼覆蓋率報告。通過以下目錄結構,我可以獲得位於tests /目錄中的源文件的代碼覆蓋範圍,但無法獲取我的src /目錄中my_file.c文件的代碼覆蓋範圍。使用lcov源代碼文件的代碼覆蓋

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 

從測試目錄調用LCOV命令:

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 

回答