mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject git commit: Introduce script for generating test coverage report.
Date Wed, 23 Jul 2014 18:48:16 GMT
Repository: mesos
Updated Branches:
  refs/heads/master 3e255dc37 -> 95c985da9


Introduce script for generating test coverage report.

Review: https://reviews.apache.org/r/23828


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/95c985da
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/95c985da
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/95c985da

Branch: refs/heads/master
Commit: 95c985da97ae9250ebf26a481370b599ea384ad6
Parents: 3e255dc
Author: Dominic Hamon <dhamon@twitter.com>
Authored: Tue Jul 22 17:00:29 2014 -0700
Committer: Dominic Hamon <dhamon@twitter.com>
Committed: Wed Jul 23 11:45:45 2014 -0700

----------------------------------------------------------------------
 support/coverage.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/95c985da/support/coverage.sh
----------------------------------------------------------------------
diff --git a/support/coverage.sh b/support/coverage.sh
new file mode 100755
index 0000000..5050b72
--- /dev/null
+++ b/support/coverage.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+set -e
+
+which lcov 1>/dev/null 2>&1
+if [ $? != 0 ]; then
+	echo "lcov is required to generate the coverage report"
+	exit 1
+fi
+
+if [[ -z $MAKE ]]; then
+	MAKE=make
+fi
+
+if [[ -z $GTEST_FILTER ]]; then
+	GTEST_FILTER='*'
+fi
+
+pushd build
+
+# Reconfigure with gcov support.
+CXXFLAGS="-pg --coverage" CFLAGS="-pg --coverage" LDFLAGS="-lgcov" ../configure --disable-optimize
+
+# Ensure no old data is in the tree.
+find -name \*.gcda | xargs rm
+find -name \*.gcno | xargs rm
+
+# Generate gcov output.
+${MAKE}
+
+lcov --directory . --zerocounters
+${MAKE} check GTEST_FILTER=${GTEST_FILTER}
+
+# Generate report.
+lcov --directory . -c -o mesos_test.info
+
+# Remove output for external libraries and generated files.
+LCOV_FILTERS="/usr/include/*"
+LCOV_FILTERS+="/usr/lib/jvm/*"
+LCOV_FILTERS+=" mesos/build/*"
+LCOV_FILTERS+=" build/3rdparty/distribute-*"
+LCOV_FILTERS+=" build/3rdparty/leveldb*"
+LCOV_FILTERS+=" build/3rdparty/zookeeper-*"
+LCOV_FILTERS+=" *libprocess/3rdparty/boost-*"
+LCOV_FILTERS+=" *libprocess/3rdparty/glog-*"
+LCOV_FILTERS+=" *libprocess/3rdparty/gmock-*"
+LCOV_FILTERS+=" *libprocess/3rdparty/picojson-*"
+LCOV_FILTERS+=" *libprocess/3rdparty/protobuf-*"
+
+for f in $LCOV_FILTERS; do
+	lcov --remove mesos_test.info $f -o mesos_test.info
+done
+
+# Generate HTML report.
+genhtml -o ./test_coverage -t "mesos test coverage" --num-spaces 2 mesos_test.info
+
+popd


Mime
View raw message