Using gcov and lcov
Upcoming SlideShare
Loading in...5
×
 

Using gcov and lcov

on

  • 21,616 views

introduction to gcov and lcov

introduction to gcov and lcov

Statistics

Views

Total Views
21,616
Views on SlideShare
19,299
Embed Views
2,317

Actions

Likes
1
Downloads
163
Comments
0

8 Embeds 2,317

http://magustest.com 2266
http://cache.baidu.com 27
http://cache.baiducontent.com 15
http://webcache.googleusercontent.com 3
http://translate.googleusercontent.com 2
http://cache.baid 2
http://reader.youdao.com 1
http://xianguo.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Using gcov and lcov Using gcov and lcov Presentation Transcript

  • Using gcov and lcov
    Magus Chen
    maguschen@hotmail.com
    http://magustest.com/blog/
  • Agenda
    gcov
    lcov
    How to apply gcov on ads
    Using lcov generate report
    Example
    2
  • Introduction to gcov
    A test coverage program
    Works only on code compiled with GCC
    Collect code coverage data and generate plain text coverage report
    3
  • Introduction to lcov
    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.
    4
  • How to apply gcov on ads
    Build 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 ads
    Copy ads binary to your own environment
    Export two envGCOV_PREFIX and GCOV_PREFIX_STRIP 
    Run ads
    Send request
    To generate code coverage data, exit the program normally (using kill, not kill -9)
    Some .gcda file is generated
    6
  • How to generate html report
    Copy all source files and .gcno files from build server to your own environment
    Copy all .gcda file to your own environment
    lcov -t 'Adserver regression' -o ads_test.info -c -d .
    -t title
    -o output file name
    -c capture coverage data
    -d use data files in DIR
    7
  • How to generate html report
    genhtml -o result ads_test.info
    -o output folder of the all html contents
    ads_test.info INFO FILE name
    8
  • How to view the HTML report
    Apache httpd
    /etc/init.d/httpd start
    Copy or link the result folder under /var/www/html/
    Lighttpd
    /usr/local/sbin/lighttpd -f lighttpd_jchen.conf
    Copy or link the result folder under server.document-root
    9
  • Example
    10
  • Q & A
    11
  • Thank you