2021年4月12日星期一

Use lcov to view the coverage

Assume main.c and x.c are the source files.

1) Add CFLAGS / CPPFLAG -fprofile-arcs -ftest-coverage when build the project, .gcno is generated

2) Execute the program    #.gcda are generarted

3) gcov main.c    #main.c.gcov is generated (Optional)

4) gcov x.c    #x.c.gcov is generated (Optional)

5) Gen html report

lcov -c --directory . --output-file main_coverage.info
genhtml main_coverage.info --output-directory out


沒有留言:

發佈留言