hdf5/bin/gcov_script
Mike McGreevy 6827c2f3b2 [svn-r14939] Purpose: Bug Fix (Bug 794)
Description:  Test gcov script on kagiso

Solution:     The bin/gcov_script was not working on kagiso (it was written to
              be used on heping, but since we don't have heping anymore, we 
              need it on kagiso). There was a problem in that the generated
              .gcda files were being created in the /src/.libs directory when
              the script was expecting them to be in the /src directory. Also,
              -lgcov was added to LDFLAGS.

              The script performs configuration of HDF5 and runs the tests, and
              generates code coverage statistics for the source code files,
              which it places in the gcov_logs directory.

              The individual *.gcov files show the number of times each 
              individual line of the associated source file is executed, and
              displays branches tken information as well. The file gcov.log
              shows a summary of each source file's coverage statistics in one
              easily accessible file.

Tested:       kagiso
2008-05-06 12:14:14 -05:00

54 lines
1.4 KiB
Bash
Executable File

#! /bin/sh
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the files COPYING and Copyright.html. COPYING can be found at the root
# of the source code distribution tree; Copyright.html can be found at the
# root level of an installed copy of the electronic HDF5 document set and
# is linked from the top-level documents page. It can also be found at
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
# access to either file, you may request a copy from help@hdfgroup.org.
# A script to generate coverage files for HDF5 using gcov.
# Configures, builds, and runs tests in-place; the output files will be placed
# in a directory called gcov_logs.
# Must be invoked from the root hdf5 directory.
# This script has been tested on kagiso.
CFLAGS="$CFLAGS -ftest-coverage -fprofile-arcs"
export CFLAGS
LDFLAGS="$LDFLAGS -lgcov"
export LDFLAGS
CC=gcc
export CC
./configure
make
make check
mkdir gcov_logs
cd src
for j in *.h *.c
do
ln -s ../$j .libs/$j
done
cd .libs
for j in *.gcda
do
gcov -b $j >> gcov.log 2>&1
done
for j in *.gcov
do
mv $j ../../gcov_logs
done
mv gcov.log ../../gcov_logs
for j in *.c *.h
do
rm $j
done
cd ../..