diff options
author | David Robillard <d@drobilla.net> | 2011-11-13 03:54:29 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-11-13 03:54:29 +0000 |
commit | bf8f0b2cb5cd41be9f709cb0cc2a445ec339d5f8 (patch) | |
tree | bc54f29d91c1713e9ce4587e085813835558ff1e /libs/evoral | |
parent | 420780f5fcc43d060bad166286dca85a651d9be8 (diff) |
Apply patch from timbyr to fix building with --test.
git-svn-id: svn://localhost/ardour2/branches/3.0@10561 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral')
-rw-r--r-- | libs/evoral/test/SMFTest.cpp | 2 | ||||
-rw-r--r-- | libs/evoral/wscript | 18 |
2 files changed, 13 insertions, 7 deletions
diff --git a/libs/evoral/test/SMFTest.cpp b/libs/evoral/test/SMFTest.cpp index b57f89e871..d4b2a28aff 100644 --- a/libs/evoral/test/SMFTest.cpp +++ b/libs/evoral/test/SMFTest.cpp @@ -40,7 +40,7 @@ SMFTest::takeFiveTest () if (ret > 0) { // didn't skip (meta) event //cerr << "read smf event type " << hex << int(buf[0]) << endl; // make ev.time absolute time in frames - ev.time() = time * frames_per_beat / (double)smf.ppqn(); + ev.set_time(time * frames_per_beat / (double)smf.ppqn()); ev.set_event_type(type_map->midi_event_type(buf[0])); seq->append(ev, next_event_id ()); } diff --git a/libs/evoral/wscript b/libs/evoral/wscript index 314fe2a2f0..e8bf097db2 100644 --- a/libs/evoral/wscript +++ b/libs/evoral/wscript @@ -26,6 +26,8 @@ def options(opt): autowaf.set_options(opt) opt.add_option('--test', action='store_true', default=False, dest='build_tests', help="Build unit tests") + opt.add_option('--test-coverage', action='store_true', default=False, dest='test_coverage', + help="Use gcov to test for code coverage") def configure(conf): conf.load('compiler_cxx') @@ -42,6 +44,7 @@ def configure(conf): autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp') conf.env['BUILD_TESTS'] = Options.options.build_tests + conf.env['TEST_COVERAGE'] = Options.options.test_coverage #autowaf.display_msg(conf, "Unit tests", str(conf.env['BUILD_TESTS'])) #print @@ -97,7 +100,7 @@ def build(bld): obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') obj.defines = ['PACKAGE="libevoral"' ] - if bld.is_defined('BUILD_TESTS') and bld.is_defined('HAVE_CPPUNIT'): + if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'): # Static library (for unit test code coverage) obj = bld(features = 'cxx cstlib') obj.source = lib_source @@ -110,8 +113,10 @@ def build(bld): obj.use = 'libsmf libpbd' obj.vnum = EVORAL_LIB_VERSION obj.install_path = '' - obj.cflags = [ '-fprofile-arcs', '-ftest-coverage' ] - obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ] + if bld.env['TEST_COVERAGE']: + obj.linkflags = '-lgcov' + obj.cflags = [ '-fprofile-arcs', '-ftest-coverage' ] + obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ] obj.defines = ['PACKAGE="libevoral"' ] # Unit tests @@ -124,12 +129,13 @@ def build(bld): obj.includes = ['.', './src'] obj.use = 'libevoral_static' obj.uselib = 'CPPUNIT SNDFILE' - obj.libs = 'gcov' obj.target = 'run-tests' obj.name = 'libevoral-tests' obj.install_path = '' - obj.cflags = [ '-fprofile-arcs', '-ftest-coverage' ] - obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ] + if bld.env['TEST_COVERAGE']: + obj.linkflags = '-lgcov' + obj.cflags = [ '-fprofile-arcs', '-ftest-coverage' ] + obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ] def shutdown(): autowaf.shutdown() |