Frysk logo Home  |  Use Cases  |  Work Flows  |  FAQ  |  Get Involved  |  Bugzilla  |  Build  |  Documentation  |  Developers

Test Coverage for Frysk

  • When developing software it is useful to determine which sections of the program the testsuites are exercising.  Having coverage information shows which sections of the code are being missed by the tests.  The GCJ compiler has an option to compile code to produce this coverage information when the code is executed.  The gcov and lcov tools can analyze this information and produce either text files or html that developers can analyze to determine whether current tests are sufficient or whether additional tests are needed.
    • To enable collection of coverage information the following GCJ options are used: --coverage -g
  • To produce coverage information for frysk, first configure a build tree as described here
  • The shell script can be used to change the Makefiles to build executables which will create coverage information.  Run make in the build tree after running the script.
  • Run the test suites with make check.   This will create the coverage information.
  • lcov converts the gcov data, which is created by running the test suites, into html files which are viewable on web pages.  lcov rpms are available for Fedora.   The advantages of lcov over gcov are:
    • lcov creates summaries showing the code coverage for each file.
    • lcov makes it easy to scan for unexecuted code by highlighting it in red
    • lcov results can be posted on a webpage.
  • The shell script can be used to create web pages from the *.gcno and *.gcda information created by gcov.
    • If a *.gcda file does not have an equivalent *.gcno file then lcov will complain.  Running sh fixup will clean these up.
    • To create the info files used to create the web pages run sh info.  It is possible that lcov will complain if either a source file cannot be found or if no *.gcno and *.gcda files are present in a directory.  In this case it may be necessary to remove offending directories from the info case in
    • To create the web pages run sh genhtml.
    •  Test results accumulate for succeeding testsuite runs and lcov posts a summary.  To zero the test results run sh zero.