From 7a7eb87152a8637c9b2e6a1fc0b0684eca574f19 Mon Sep 17 00:00:00 2001 From: thevenyp Date: Tue, 21 Oct 2008 08:17:08 +0000 Subject: tools/README.coverage, tools/coverage: Add script and doc for test suite coverage. git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@261 211d60ee-9f03-0410-a15a-8952a2c7a4e4 --- tools/README.coverage | 9 +++++++++ tools/coverage | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 tools/README.coverage create mode 100755 tools/coverage (limited to 'tools') diff --git a/tools/README.coverage b/tools/README.coverage new file mode 100644 index 0000000..ec6ab85 --- /dev/null +++ b/tools/README.coverage @@ -0,0 +1,9 @@ +The script "coverage" compute the test suite coverage of MPC in terms of line +of code and summarize it into web pages. +You will need gcov and lcov (http://ltp.sourceforge.net/coverage/lcov.php). + +Usage: +cd path_to_mpc_sources/tools +./coverage + +After execution, the html pages lie in the directory /tmp/ompc-gcov/html. diff --git a/tools/coverage b/tools/coverage new file mode 100755 index 0000000..fd13837 --- /dev/null +++ b/tools/coverage @@ -0,0 +1,34 @@ +#!/bin/bash +# Test coverage using gcov & lcov +# download lcov in http://ltp.sourceforge.net/coverage/lcov.php +# +# An adaptation of Patrick Pellissier's script in MPFR + +SRC_DIR=`pwd`/.. +DEST_DIR=/tmp/ompc-gcov +REVISION=$(cd ..; svn info|sed -n '/Revision: / p'); + +# First Build MPC in /tmp/ +echo "Erasing previous " $DEST_DIR +rm -rf $DEST_DIR +mkdir $DEST_DIR +echo "Copying MPC sources to "$DEST_DIR +cp $SRC_DIR/* $DEST_DIR 2>/dev/null +mkdir $DEST_DIR/doc +cp $SRC_DIR/doc/* $DEST_DIR/doc +mkdir $DEST_DIR/src +cp $SRC_DIR/src/{Makefile*,*.h,*.c} $DEST_DIR/src +mkdir $DEST_DIR/tests +cp $SRC_DIR/tests/{Makefile*,*.h,*.c,*.dat} $DEST_DIR/tests +cd $DEST_DIR +echo "Building MPC" +./configure --enable-assert --disable-shared --enable-static \ + CFLAGS="-fprofile-arcs -ftest-coverage -g" +make check -j -l 2 + +mkdir html +lcov -o html/mpc.capture -t "$REVISION" -d src -c +lcov -o html/mpc.info -r html/mpc.capture *gmp*.h +genhtml -o html --no-prefix -t "$REVISION" html/mpc.info + +echo "See results in "$DEST_DIR"/html/index.html" -- cgit v1.2.1