Unit test code coverage using lcov.

git-svn-id: svn://localhost/ardour2/branches/3.0@5892 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2009-10-23 17:30:11 +00:00
parent 49a6e300c3
commit 8340dcdd57
2 changed files with 59 additions and 18 deletions

View file

@ -1,8 +1,29 @@
#!/bin/sh
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../build/default/libs/evoral
if test -f ./test/testdata/TakeFive.mid
then
../../build/default/libs/evoral/run-tests
else
echo "This script must be run from within the libs/evoral directory"
if [ ! -f './test/testdata/TakeFive.mid' ]; then
echo "This script must be run from within the libs/evoral directory";
exit 1;
fi
srcdir=`pwd`
# Make symlink to TakeFive.mid in build directory
cd ../../build/default/libs/evoral
mkdir -p ./test/testdata
ln -fs $srcdir/test/testdata/TakeFive.mid \
./test/testdata/TakeFive.mid
lcov -d ./src -z
./run-tests
lcov -d ./src -d ./test -b ../../.. -c > coverage.lcov
lcov -r coverage.lcov *boost* *c++* *usr/include* -o coverage.lcov
mkdir -p ./coverage
genhtml -o coverage coverage.lcov
#rm -r coverage/boost
#rm -r coverage/usr
#rm -r coverage/c++
#rm -r coverage/cppunit
#rm -r coverage/glibmm-2.4
#rm -r coverage/sigc++-2.0
echo "Report written to:"
echo "../../build/default/libs/evoral/coverage/index.html"

View file

@ -70,9 +70,7 @@ def build(bld):
libsmf.uselib = 'GLIB'
libsmf.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
# Library
obj = bld.new_task_gen('cxx', 'shlib')
obj.source = '''
lib_source = '''
src/Control.cpp
src/ControlList.cpp
src/ControlSet.cpp
@ -84,17 +82,36 @@ def build(bld):
src/SMF.cpp
src/Sequence.cpp
'''
obj.export_incdirs = ['.']
obj.includes = ['.', './src']
obj.name = 'libevoral'
obj.target = 'evoral'
obj.uselib = 'GLIBMM GTHREAD SMF'
obj.uselib_local = 'libsmf'
obj.vnum = EVORAL_LIB_VERSION
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
# Unit tests
# Library
obj = bld.new_task_gen('cxx', 'shlib')
obj.source = lib_source
obj.export_incdirs = ['.']
obj.includes = ['.', './src']
obj.name = 'libevoral'
obj.target = 'evoral'
obj.uselib = 'GLIBMM GTHREAD SMF'
obj.uselib_local = 'libsmf'
obj.vnum = EVORAL_LIB_VERSION
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']:
# Static library (for unit test code coverage)
obj = bld.new_task_gen('cxx', 'staticlib')
obj.source = lib_source
obj.source = lib_source
obj.export_incdirs = ['.']
obj.includes = ['.', './src']
obj.name = 'libevoral_static'
obj.target = 'evoral_static'
obj.uselib = 'GLIBMM GTHREAD SMF'
obj.uselib_local = 'libsmf'
obj.vnum = EVORAL_LIB_VERSION
obj.install_path = ''
obj.ccflags = [ '-fprofile-arcs', '-ftest-coverage' ]
obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ]
# Unit tests
obj = bld.new_task_gen('cxx', 'program')
obj.source = '''
test/SequenceTest.cpp
@ -102,10 +119,13 @@ def build(bld):
test/testrunner.cpp
'''
obj.includes = ['.', './src']
obj.uselib_local = 'libevoral'
obj.uselib_local = 'libevoral_static'
obj.uselib = 'CPPUNIT'
obj.libs = 'gcov'
obj.target = 'run-tests'
obj.install_path = ''
obj.ccflags = [ '-fprofile-arcs', '-ftest-coverage' ]
obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ]
def shutdown():
autowaf.shutdown()