sintonia/livesupport/bin/gen_coverage_data.sh

92 lines
4.2 KiB
Bash
Executable File

#!/bin/sh
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LiveSupport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: maroy $
# Version : $Revision: 1.6 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/gen_coverage_data.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script generates code coverage data for all modules
#-------------------------------------------------------------------------------
module="LiveSupport"
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
docdir=$basedir/doc
tmpdir=$basedir/tmp
modules_dir=$basedir/modules
products_dir=$basedir/products
usrdir=`cd $basedir/usr; pwd;`
coverage_report_dir=$docdir/coverage
core_coverage_file=$modules_dir/core/tmp/coverage.info
authentication_coverage_file=$modules_dir/authentication/tmp/coverage.info
db_coverage_file=$modules_dir/db/tmp/coverage.info
storage_coverage_file=$modules_dir/storage/tmp/coverage.info
eventScheduler_coverage_file=$modules_dir/eventScheduler/tmp/coverage.info
schedulerClient_coverage_file=$modules_dir/schedulerClient/tmp/coverage.info
playlistExecutor_coverage_file=$modules_dir/playlistExecutor/tmp/coverage.info
scheduler_coverage_file=$products_dir/scheduler/tmp/coverage.info
coverage_file=$tmpdir/coverage.info
lcov=$usrdir/bin/lcov
genhtml=$usrdir/bin/genhtml
#-------------------------------------------------------------------------------
# Execute the coverage tests one by one
#-------------------------------------------------------------------------------
$modules_dir/core/bin/gen_coverage_data.sh
$modules_dir/authentication/bin/gen_coverage_data.sh
$modules_dir/db/bin/gen_coverage_data.sh
$modules_dir/storage/bin/gen_coverage_data.sh
$modules_dir/eventScheduler/bin/gen_coverage_data.sh
$modules_dir/schedulerClient/bin/gen_coverage_data.sh
$modules_dir/playlistExecutor/bin/gen_coverage_data.sh
$products_dir/scheduler/bin/gen_coverage_data.sh
#-------------------------------------------------------------------------------
# Gather all the coverage information into one file
# remove references to the tmp directories, and replace them with the module
# directories themselves. this way the source files are found easlity by lcov
#-------------------------------------------------------------------------------
echo "" > $coverage_file
cat $core_coverage_file | sed -e "s/core\/tmp\//core\//g" >> $coverage_file
cat $authentication_coverage_file | sed -e "s/authentication\/tmp\//authentication\//g" >> $coverage_file
cat $db_coverage_file | sed -e "s/db\/tmp\//db\//g" >> $coverage_file
cat $storage_coverage_file | sed -e "s/storage\/tmp\//storage\//g" >> $coverage_file
cat $eventScheduler_coverage_file | sed -e "s/eventScheduler\/tmp\//eventScheduler\//g" >> $coverage_file
cat $schedulerClient_coverage_file | sed -e "s/schedulerClient\/tmp\//schedulerClient\//g" >> $coverage_file
cat $playlistExecutor_coverage_file | sed -e "s/playlistExecutor\/tmp\//playlistExecutor\//g" >> $coverage_file
cat $scheduler_coverage_file | sed -e "s/scheduler\/tmp\//scheduler\//g" >> $coverage_file
rm -rf $coverage_report_dir
mkdir -p $coverage_report_dir
$genhtml -t "$module" -o $coverage_report_dir $coverage_file