dhodovsk / source-git / pacemaker

Forked from source-git/pacemaker 3 years ago
Clone

Blame cts/cts-coverage.in

rpm-build 3ee90c
#!@BASH_PATH@
rpm-build 3ee90c
#
rpm-build 3ee90c
# Copyright 2012-2018 the Pacemaker project contributors
rpm-build 3ee90c
#
rpm-build 3ee90c
# The version control history for this file may have further details.
rpm-build 3ee90c
#
rpm-build 3ee90c
# This source code is licensed under the GNU General Public License version 2
rpm-build 3ee90c
# or later (GPLv2+) WITHOUT ANY WARRANTY.
rpm-build 3ee90c
#
rpm-build 3ee90c
rpm-build 3ee90c
start="$PWD"
rpm-build 3ee90c
test_home=$(dirname "$0")
rpm-build 3ee90c
test_dir="@datadir@/@PACKAGE@/tests"
rpm-build 3ee90c
rpm-build 3ee90c
if [ "$test_home" != "$test_dir" ]; then
rpm-build 3ee90c
    # Running against the source tree
rpm-build 3ee90c
    GCOV_BASE="@abs_top_srcdir@"
rpm-build 3ee90c
    test_dir="@abs_top_srcdir@/cts"
rpm-build 3ee90c
    cd "@abs_top_srcdir@" || exit 1
rpm-build 3ee90c
    
rpm-build 3ee90c
    grep with-gcov config.log
rpm-build 3ee90c
    if [ $? -eq 0 ]; then
rpm-build 3ee90c
	echo "Pacemaker was built with gcov support"
rpm-build 3ee90c
    else
rpm-build 3ee90c
	echo "Re-building with gcov support"
rpm-build 3ee90c
	last=`grep --color=never "$.*configure" config.log | tail -n 1 | sed s:.*configure:./configure: | sed s:--no-create:--with-gcov:`
rpm-build 3ee90c
	eval $last
rpm-build 3ee90c
    fi
rpm-build 3ee90c
    
rpm-build 3ee90c
    #sudo make core core-install
rpm-build 3ee90c
rpm-build 3ee90c
else
rpm-build 3ee90c
    GCOV_BASE=@localstatedir@/lib/pacemaker/gcov/
rpm-build 3ee90c
    mkdir -p $GCOV_BASE
rpm-build 3ee90c
rpm-build 3ee90c
    export GCOV_PREFIX_STRIP=4
rpm-build 3ee90c
    export GCOV_PREFIX=$GCOV_BASE
rpm-build 3ee90c
rpm-build 3ee90c
    top=`find / -name crm_internal.h 2>/dev/null | grep debug | head -n 1`
rpm-build 3ee90c
    if [ "x$top" = x ]; then
rpm-build 3ee90c
	echo "Could not locate the pacemaker headers"
rpm-build 3ee90c
	exit 1
rpm-build 3ee90c
    fi
rpm-build 3ee90c
rpm-build 3ee90c
    cd "$(dirname "$top")" || exit 1
rpm-build 3ee90c
    cd .. || exit 1
rpm-build 3ee90c
rpm-build 3ee90c
    echo "Creating the directory structure in $GCOV_BASE from $PWD"
rpm-build 3ee90c
    # The .gcno files will already be there for sources,
rpm-build 3ee90c
    # but we still need to create the include/ subtree
rpm-build 3ee90c
    find . -type d -exec mkdir -p $GCOV_BASE/\{\} \;
rpm-build 3ee90c
rpm-build 3ee90c
    echo "Now linking the source files into place"
rpm-build 3ee90c
    find . -type f -name "*.c" -exec ln -s $PWD/\{\} $GCOV_BASE\{\} \;
rpm-build 3ee90c
    find . -type f -name "*.h" -exec ln -s $PWD/\{\} $GCOV_BASE\{\} \;
rpm-build 3ee90c
    find . -type f -name "*.debug" -exec ln -s $PWD/\{\} $GCOV_BASE\{\} \;
rpm-build 3ee90c
fi
rpm-build 3ee90c
rpm-build 3ee90c
cd "$start" || exit 1
rpm-build 3ee90c
lcov -d $GCOV_BASE -z
rpm-build 3ee90c
rpm-build 3ee90c
# Run all active regression tests
rpm-build 3ee90c
$test_dir/cts-regression
rpm-build 3ee90c
rpm-build 3ee90c
lcov -d $GCOV_BASE -c -o pacemaker.info
rpm-build 3ee90c
rpm-build 3ee90c
rm -rf html
rpm-build 3ee90c
mkdir html
rpm-build 3ee90c
genhtml -o html pacemaker.info
rpm-build 3ee90c