summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2008-10-21 08:17:08 +0000
committerthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2008-10-21 08:17:08 +0000
commit7a7eb87152a8637c9b2e6a1fc0b0684eca574f19 (patch)
tree973ef6eaf0034763faf09da03907075e16722cb2 /tools
parent600c38b7f81297983f9847c56d8603fda7a1b7b8 (diff)
downloadmpc-7a7eb87152a8637c9b2e6a1fc0b0684eca574f19.tar.gz
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
Diffstat (limited to 'tools')
-rw-r--r--tools/README.coverage9
-rwxr-xr-xtools/coverage34
2 files changed, 43 insertions, 0 deletions
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"