[OracleOSS] [TitleIndex] [WordIndex]

OCFS2/CodeCoverage

OCFS2 CODE COVERAGE ANALYSIS

This page documents the steps to perform code coverage analysis for OCFS2.

Introduction

GCOV, provided with GCC, allows one to generate and extract code coverage information for all user space apps. The LTP project provides a gcov-kernel patch that extends the same facility to the kernel code. It does so by providing a directory of virtual files (/proc/gcov) which are compatible with gcc's gcov tool (See manpage of gcov for more information).

Steps

$ cvs -d:pserver:anonymous@ltp.cvs.sourceforge.net:/cvsroot/ltp login
(Press Enter when prompted for the password.)
$ cvs -z3 -d:pserver:anonymous@ltp.cvs.sourceforge.net:/cvsroot/ltp co -P utils
(The patches are typically under the analysis directory.)

Configuration options:
----------------------
CONFIG_GCOV_PROFILE=y
  Basic gcov support. Say 'y' here.

CONFIG_GCOV_ALL=n
  Say 'y' here if you want to get gcov data for the entire kernel. Otherwise
  add the line

    EXTRA_CFLAGS += $(GCOV_FLAGS)

  to the respective Makefiles.

CONFIG_GCOV_PROC=y
  Provide /proc/gcov. Say 'y' here.

CONFIG_GCOV_HAMMER=n
  Say 'n' here unless you are using a modified gcc 3.3.x compiler (e.g. shipped
  with SUSE SLES9 or Mandrake 10.x). Note: an incorrect setting of this option
  may result in compile time errors or in file format errors in /proc/gcov.

If you've obtained the kernel-gcov patch from oss, the OCFS2 Makefiles should have the GCOV_FLAGS already set.

$ lcov --zerocounters

$ lcov --capture --test-name TESTNAME --output-file OUTFILE

$ genhtml --css-file gcov.css --output-directory OUTDIR OUTFILE1 OUTFILE2 ...

Links

Linux Test Project

Linux Test Project

LTP FAQ

LTP README

LCOV


2012-11-08 13:01