From 0d009a4e980e40dc8a9c9b5e3d25c3fafb363e95 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 7 Jan 2010 21:27:39 +0000 Subject: Move unit testing and coverage framework into autowaf. Make raul tests return 0 on success, 1 on failure. Test coverage for Raul. git-svn-id: http://svn.drobilla.net/lad/trunk/raul@2368 a436a847-0d15-0410-975c-d299462d15a1 --- wscript | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) (limited to 'wscript') diff --git a/wscript b/wscript index 2a91358..20063dc 100644 --- a/wscript +++ b/wscript @@ -59,6 +59,20 @@ def configure(conf): autowaf.print_summary(conf) autowaf.display_msg(conf, "Unit tests", str(conf.env['BUILD_TESTS'])) print + +tests = ''' + test/path_test + test/thread_test + test/queue_test + test/ringbuffer_test + test/midi_ringbuffer_test + test/atomic_test + test/list_test + test/time_test + test/quantize_test + test/smf_test + test/table_test +''' def build(bld): # Headers @@ -68,9 +82,7 @@ def build(bld): # Pkgconfig file autowaf.build_pc(bld, 'RAUL', RAUL_VERSION, 'GLIBMM GTHREAD') - # Library - obj = bld.new_task_gen('cxx', 'shlib') - obj.source = ''' + lib_source = ''' src/Configuration.cpp src/Maid.cpp src/Path.cpp @@ -80,21 +92,48 @@ def build(bld): src/Thread.cpp src/log.cpp ''' + + # Library + obj = bld.new_task_gen('cxx', 'shlib') obj.export_incdirs = ['.'] + obj.source = lib_source obj.includes = ['.', './src'] obj.name = 'libraul' obj.target = 'raul' obj.uselib = 'GLIBMM GTHREAD' obj.install_path = '${LIBDIR}' obj.vnum = RAUL_LIB_VERSION + + if bld.env['BUILD_TESTS']: + # Static library (for unit test code coverage) + obj = bld.new_task_gen('cxx', 'staticlib') + obj.source = lib_source + obj.includes = ['.', './src'] + obj.name = 'libraul_static' + obj.target = 'raul_static' + obj.uselib = 'GLIBMM GTHREAD' + obj.install_path = '' + obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ] - # Unit tests - bld.add_subdirs('tests') + # Unit tests + for i in tests.split(): + obj = bld.new_task_gen('cxx', 'program') + obj.source = i + '.cpp' + obj.includes = '..' + obj.uselib_local = 'libraul_static' + obj.uselib = 'GLIB GLIBMM' + obj.libs = 'gcov' + obj.target = i + obj.install_path = '' + obj.cxxflags = [ '-fprofile-arcs', '-ftest-coverage' ] # Documentation autowaf.build_dox(bld, 'RAUL', RAUL_VERSION, srcdir, blddir) bld.install_files('${HTMLDIR}', blddir + '/default/doc/html/*') +def test(ctx): + autowaf.run_tests(APPNAME, tests.split()) + def shutdown(): autowaf.shutdown() -- cgit v1.2.1