[asterisk-commits] russell: testsuite/bamboo/trunk r792 - /bamboo/trunk/bin/build-libpri.sh

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 16 16:25:16 CDT 2010


Author: russell
Date: Thu Sep 16 16:25:12 2010
New Revision: 792

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=792
Log:
Enable code coverage analysis for LibPRI builds.

Modified:
    bamboo/trunk/bin/build-libpri.sh

Modified: bamboo/trunk/bin/build-libpri.sh
URL: http://svnview.digium.com/svn/testsuite/bamboo/trunk/bin/build-libpri.sh?view=diff&rev=792&r1=791&r2=792
==============================================================================
--- bamboo/trunk/bin/build-libpri.sh (original)
+++ bamboo/trunk/bin/build-libpri.sh Thu Sep 16 16:25:12 2010
@@ -1,4 +1,11 @@
 #!/bin/sh
+
+PLAN=$1
+
+if [ "${PLAN}" = "PRI-14" ] ; then
+	# Analyze code coverage.
+	COVERAGE=yes
+fi
 
 if which gmake ; then
     MAKE=gmake
@@ -8,12 +15,27 @@
 
 RESULT_FILE=test-reports/libpri-report.xml
 
-# Compile libpri without optimization
-#${MAKE} LIBPRI_OPT=
-${MAKE}
-${MAKE} install
+if [ "${COVERAGE}" = "yes" ] ; then
+	COVERAGE_MAKE_ARGS="CODE_COVERAGE=yes"
+fi
 
-${MAKE} rosetest
+gen_coverage_report() {
+	if ! which lcov ; then
+		echo "*** ERROR: lcov not installed.  No coverage report will be generated."
+		return
+	fi
+
+	sudo lcov --directory `pwd` --capture --output-file libpri.info
+
+	mkdir coverage
+	cd coverage
+	genhtml ../libpri.info
+	cd ..
+}
+
+${MAKE} ${COVERAGE_MAKE_ARGS}
+${MAKE} ${COVERAGE_MAKE_ARGS} install
+${MAKE} ${COVERAGE_MAKE_ARGS} rosetest
 
 mkdir -p test-reports
 
@@ -42,4 +64,10 @@
     echo "</testsuite>" >> ${RESULT_FILE}
 fi
 
+if [ "${COVERAGE}" = "yes" ] ; then
+	gen_coverage_report
+fi
+
+cat ${RESULT_FILE}
+
 rm -rf errors.txt errs.txt




More information about the asterisk-commits mailing list