130 likes | 166 Views
SPI Software Process & Infrastructure. QA http://spi.cern.ch/qa Gcov presentation - 03 June 2005 Johanne BENARD johanne.benard@cern.ch. GCOV presentation. What is Gcov ? Code Analysis principle Coverage tool Other utilities Application on ROOT Compilation Test running Result.
E N D
SPI Software Process & Infrastructure QA http://spi.cern.ch/qa Gcov presentation - 03 June 2005 Johanne BENARD johanne.benard@cern.ch
GCOV presentation What is Gcov ? • Code Analysis principle • Coverage tool • Other utilities Application on ROOT • Compilation • Test running • Result SPI - Software Process & Infrastructure
Code analysis principle • Aim at showing what percentage of an application has been executed by the test process. • Two different principles in gcov: Statement coverage analysis which breaks the code down into basic blocs. Then by construction, if a line is executed a given number of times, every instruction line within the basic block would have been executed the same number of times. Branch coverage analysis which rather than focusing on a basic blocks, will look at possible paths a conditional can take and how often each path through the conditional is taken. Then knowledge of how many times each line of code was executed can be derived by knowing how many times each conditional was evaluated for each possible outcome. SPI - Software Process & Infrastructure
Coverage tool • Code instrumentation during compilation: • GCC must be used to compile the program with the flags -fprofile-arcs -ftest-coverage • GCC generates two output files for each Sourcefile.c compiled: • Sourcefile.bb: list of source files and functions within those files and line numbers corresponding to basic blocks in the source file ) • Sourcefile.bbg: list of the program flow arcs for each function • Data collection during code execution: • Counter vector entries are incremented every time an instrumented basic block is entered SPI - Software Process & Infrastructure
Coverage tool • Data extraction at program exit time: • Creates a file sourcefile.da and populates the file with the size of the vector and the counters of the vector itself • Coverage analysis and presentation: • GCOV utility integrates and relates the information of the "*.bbg", "*.bb" and the "*.da" to produce the "*.gcov" files containing per line coverage output Compilation time Runtime Coverage analysis File.bb File.c File.da File.gcov File.bbg SPI - Software Process & Infrastructure
Other utilities • Genhtml: • Creates an HTML view from coverage data found in INFOFILE • Geninfo: • Converts .da files into .info files • Genpgn: • Creates an overview image for a given source code file of either plain text or .gcov file format • Gendesc: • Converts a test case description file into a format as understood by genhtml INPUTFILE SPI - Software Process & Infrastructure
Application to ROOT • Compilation: • Edition of MyConfig.mk in $ROOTSYS • Link the shared libraries with libgcc.a • Test running: • In $ROOTSYS/test • In roottest • Results: SPI - Software Process & Infrastructure
ROOT test coverage report SPI - Software Process & Infrastructure
ROOT test coverage report SPI - Software Process & Infrastructure
More information • Please visit our web site: http://spi.cern.ch/qa/gcov • Proposed next actions: • Publication of test coverage for ROOT • at a given frequency? • Addressed to a QA person? • Run it on CVS tagged or HEAD source • Add a section on SPI/QA web site dedicated to test coverage for ROOT • Produce automatically a list of files that have less than 80% test coverage SPI - Software Process & Infrastructure
Conclusion Thank you for your attention! Question? SPI - Software Process & Infrastructure