Using gcov and lcovMagus Chenmaguschen@hotmail.comhttp://magustest.com/blog/
AgendagcovlcovHow to apply gcov on adsUsing lcov generate reportExample2
Introduction to gcovA test coverage programWorks only on code compiled with GCCCollect code coverage data and generate plain text coverage report3
Introduction to lcovLCOV 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.4
How to apply gcov on adsBuild adserver with option “--coverage”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).5
How to apply gcov on adsCopy ads binary to your own environment Export two envGCOV_PREFIX and GCOV_PREFIX_STRIP Run adsSend requestTo generate code coverage data, exit the program normally (using kill, not kill -9)Some .gcda file is generated6
How to generate html reportCopy all source files and .gcno files from build server to your own environmentCopy all .gcda file to your own environmentlcov -t 'Adserver regression' -o ads_test.info -c -d .-t title-o output file name-c capture coverage data-d use data files in DIR7
How to generate html reportgenhtml -o result ads_test.info -o output folder of the all html contentsads_test.info INFO FILE name8
How to view the HTML reportApache httpd/etc/init.d/httpd startCopy or link the result folder under /var/www/html/Lighttpd/usr/local/sbin/lighttpd -f lighttpd_jchen.confCopy or link the result folder under server.document-root9
Example10
Q & A11
Thank you

Using gcov and lcov

  • 1.
    Using gcov andlcovMagus Chenmaguschen@hotmail.comhttp://magustest.com/blog/
  • 2.
    AgendagcovlcovHow to applygcov on adsUsing lcov generate reportExample2
  • 3.
    Introduction to gcovAtest coverage programWorks only on code compiled with GCCCollect code coverage data and generate plain text coverage report3
  • 4.
    Introduction to lcovLCOVis 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.4
  • 5.
    How to applygcov on adsBuild adserver with option “--coverage”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).5
  • 6.
    How to applygcov on adsCopy ads binary to your own environment Export two envGCOV_PREFIX and GCOV_PREFIX_STRIP Run adsSend requestTo generate code coverage data, exit the program normally (using kill, not kill -9)Some .gcda file is generated6
  • 7.
    How to generatehtml reportCopy all source files and .gcno files from build server to your own environmentCopy all .gcda file to your own environmentlcov -t 'Adserver regression' -o ads_test.info -c -d .-t title-o output file name-c capture coverage data-d use data files in DIR7
  • 8.
    How to generatehtml reportgenhtml -o result ads_test.info -o output folder of the all html contentsads_test.info INFO FILE name8
  • 9.
    How to viewthe HTML reportApache httpd/etc/init.d/httpd startCopy or link the result folder under /var/www/html/Lighttpd/usr/local/sbin/lighttpd -f lighttpd_jchen.confCopy or link the result folder under server.document-root9
  • 10.
  • 11.
  • 12.