From ab1cbbc753de30362827c6e26d3b9fea18bd8cda Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 13 Dec 2008 01:27:45 +0000 Subject: Unit test code coverage report generation (via gcov/lcov). git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@1852 a436a847-0d15-0410-975c-d299462d15a1 --- test/test_coverage.sh | 16 ++++++++++++++++ test/wscript | 17 ++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100755 test/test_coverage.sh (limited to 'test') diff --git a/test/test_coverage.sh b/test/test_coverage.sh new file mode 100755 index 0000000..9df5ebc --- /dev/null +++ b/test/test_coverage.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Run this script (from the directory it's in) after building +# (with waf configure --debug --test) to run the +# unit tests and generate a code coverage report + +cd ../build/default + +lcov -d ./src -z +./test/slv2_test +lcov -d ./src -b .. -c > coverage.lcov +mkdir -p ./coverage +genhtml -o coverage coverage.lcov +echo "Report written to:" +echo "../build/default/coverage/index.html" + diff --git a/test/wscript b/test/wscript index ad4bb8e..d328efa 100644 --- a/test/wscript +++ b/test/wscript @@ -4,11 +4,14 @@ def build(bld): tests = ''' slv2_test ''' - for i in tests.split(): - obj = bld.new_task_gen('cc', 'program') - obj.source = i + '.c' - obj.includes = '..' - obj.uselib_local = 'libslv2' - obj.target = i - obj.install_path = '' + if bld.env['BUILD_TESTS']: + for i in tests.split(): + obj = bld.new_task_gen('cc', 'program') + obj.source = i + '.c' + obj.includes = '..' + obj.uselib_local = 'libslv2_static' + obj.uselib = 'REDLAND LV2CORE' + obj.libs = 'gcov' + obj.target = i + obj.install_path = '' -- cgit v1.2.1