Using gcov and lcov<br />Magus Chen<br />maguschen@hotmail.com<br />http://magustest.com/blog/<br />
Agenda<br />gcov<br />lcov<br />How to apply gcov on ads<br />Using lcov generate report<br />Example<br />2<br />
Introduction to gcov<br />A test coverage program<br />Works only on code compiled with GCC<br />Collect code coverage dat...
Introduction to lcov<br />LCOV is a graphical front-end for GCC's coverage testing tool gcov. It collects gcov data for mu...
How to apply gcov on ads<br />Build adserver with option “--coverage”<br />This option is used to compile and link code in...
How to apply gcov on ads<br />Copy ads binary to your own environment <br />Export two envGCOV_PREFIX and GCOV_PREFIX_STRI...
How to generate html report<br />Copy all source files and .gcno files from build server to your own environment<br />Copy...
How to generate html report<br />genhtml -o result ads_test.info <br />-o output folder of the all html contents<br />ads_...
How to view the HTML report<br />Apache httpd<br />/etc/init.d/httpd start<br />Copy or link the result folder under /var/...
Example<br />10<br />
Q & A<br />11<br />
Thank you<br />
Upcoming SlideShare
Loading in...5
×

Using gcov and lcov

23,367

Published on

introduction to gcov and lcov

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
23,367
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
194
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "Using gcov and lcov"

  1. 1. Using gcov and lcov<br />Magus Chen<br />maguschen@hotmail.com<br />http://magustest.com/blog/<br />
  2. 2. Agenda<br />gcov<br />lcov<br />How to apply gcov on ads<br />Using lcov generate report<br />Example<br />2<br />
  3. 3. Introduction to gcov<br />A test coverage program<br />Works only on code compiled with GCC<br />Collect code coverage data and generate plain text coverage report<br />3<br />
  4. 4. Introduction to lcov<br />LCOV is a graphical front-end for GCC's coverage testing tool gcov. It collects gcov data for multiple source files and creates HTML pages containing the source code annotated with coverage information. It also adds overview pages for easy navigation within the file structure. LCOV supports statement, function and branch coverage measurement.<br />4<br />
  5. 5. How to apply gcov on ads<br />Build adserver with option “--coverage”<br />This option is used to compile and link code instrumented for coverage analysis. The option is a synonym for -fprofile-arcs-ftest-coverage (when compiling) and -lgcov (when linking).<br />5<br />
  6. 6. How to apply gcov on ads<br />Copy ads binary to your own environment <br />Export two envGCOV_PREFIX and GCOV_PREFIX_STRIP <br />Run ads<br />Send request<br />To generate code coverage data, exit the program normally (using kill, not kill -9)<br />Some .gcda file is generated<br />6<br />
  7. 7. How to generate html report<br />Copy all source files and .gcno files from build server to your own environment<br />Copy all .gcda file to your own environment<br />lcov -t 'Adserver regression' -o ads_test.info -c -d .<br />-t title<br />-o output file name<br />-c capture coverage data<br />-d use data files in DIR<br />7<br />
  8. 8. How to generate html report<br />genhtml -o result ads_test.info <br />-o output folder of the all html contents<br />ads_test.info INFO FILE name<br />8<br />
  9. 9. How to view the HTML report<br />Apache httpd<br />/etc/init.d/httpd start<br />Copy or link the result folder under /var/www/html/<br />Lighttpd<br />/usr/local/sbin/lighttpd -f lighttpd_jchen.conf<br />Copy or link the result folder under server.document-root<br />9<br />
  10. 10. Example<br />10<br />
  11. 11. Q & A<br />11<br />
  12. 12. Thank you<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×