diff options
author | 2011-08-04 17:01:11 +0800 | |
---|---|---|
committer | 2011-08-04 22:15:15 +0800 | |
commit | 50d971dace5e40e4ed08ca1fdc835d9b016635b3 (patch) | |
tree | 0a985c09546e8e7cc4089fbc3582e93c747dabc3 /test | |
parent | Doc: remove useless doxample.am (diff) | |
download | libbash-50d971dace5e40e4ed08ca1fdc835d9b016635b3.tar.gz libbash-50d971dace5e40e4ed08ca1fdc835d9b016635b3.tar.bz2 libbash-50d971dace5e40e4ed08ca1fdc835d9b016635b3.zip |
Test: move test_coverage.sh to test/
Diffstat (limited to 'test')
-rwxr-xr-x | test/test_coverage.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test_coverage.sh b/test/test_coverage.sh new file mode 100755 index 0000000..20f70d9 --- /dev/null +++ b/test/test_coverage.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +which lcov 1>/dev/null 2>&1 +if [ $? != 0 ] +then + echo "You need to have lcov installed in order to generate the test coverage report" + exit 1 +fi + +if [ ! $DIST_ARCHIVES ] +then + echo "You need to provide the archive name by running DIST_ARCHIVES=\"ARCHIVE_NAME\" $0" + exit 1 +fi + +tar zxf $DIST_ARCHIVES +srcdir=${DIST_ARCHIVES/.tar.gz} +cd $srcdir + +# Reconfigure with gcov support +CXXFLAGS="-g -O0 --coverage" CFLAGS="-g -O0 --coverage" ./autogen.sh --disable-shared + +# Generate gcov output +${MAKE} + +# Generate html report +lcov --base-directory . --directory . --zerocounters -q +${MAKE} check +lcov --base-directory . --directory . -c -o libbash_test.info +lcov --remove libbash_test.info "/usr*" -o libbash_test.info # remove output for external libraries +rm -rf ../test_coverage +genhtml -o ../test_coverage -t "libbash test coverage" --num-spaces 4 libbash_test.info + +# Clean work space +cd .. && rm -rf $srcdir |