wscript: move test build rules from tests/src/wscript_build, use new unit test system
authorPaul Brossier <piem@piem.org>
Tue, 29 Sep 2009 18:45:41 +0000 (20:45 +0200)
committerPaul Brossier <piem@piem.org>
Tue, 29 Sep 2009 18:45:41 +0000 (20:45 +0200)
tests/src/wscript_build [deleted file]
wscript

diff --git a/tests/src/wscript_build b/tests/src/wscript_build
deleted file mode 100644 (file)
index 02f1089..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# loop over all *.c filenames in tests/src to build them all
-# target name is filename.c without the .c
-for target_name in bld.path.ant_glob('*.c').split():
-  this_target = bld.new_task_gen(
-      features = 'cprogram cc', # test',
-      includes = '../../src',
-      uselib_local = 'aubio',
-      unit_test = 1,
-      source = target_name,
-      target = target_name.split('.')[0],
-      install_path = None)
-  if target_name == 'test-phasevoc-jack.c':
-    this_target.includes = '../../src ../../ext'
-    this_target.uselib_local = ['aubio', 'aubioext']
diff --git a/wscript b/wscript
index 3e7daeafc214f438722489141b3967083e396230..b3eea20af01480389c2263717b7d41639e03d675 100644 (file)
--- a/wscript
+++ b/wscript
@@ -12,8 +12,6 @@ LIB_VERSION = '2.1.1'
 srcdir = '.'
 blddir = 'build'
 
-import UnitTest
-
 def init(opt):
   pass
 
@@ -35,7 +33,9 @@ def set_options(opt):
   opt.tool_options('compiler_cc')
   opt.tool_options('compiler_cxx')
   opt.tool_options('gnu_dirs')
-  #opt.tool_options('UnitTest')
+  # include locally patched version of UnitTest until upstream incorporates patch
+  # see http://code.google.com/p/waf/issues/detail?id=542
+  opt.tool_options('UnitTest', tooldir='.')
 
 def configure(conf):
   import Options
@@ -137,7 +137,7 @@ def build(bld):
   bld.env['LIB_VERSION'] = LIB_VERSION 
 
   # add sub directories
-  bld.add_subdirs('src ext examples cpp tests/src')
+  bld.add_subdirs('src ext examples cpp')
   if bld.env['SWIG']:
     if bld.env['PYTHON']:
       bld.add_subdirs('python/aubio python')
@@ -171,11 +171,26 @@ def build(bld):
   bld.install_files('${PREFIX}/share/sounds/aubio/', 
       'sounds/woodblock.aiff')
 
+  # build and run the unit tests
+  build_tests(bld)
+  import UnitTest
+  bld.add_post_fun(UnitTest.summary)
+
 def shutdown(bld):
   pass
 
-def check(bld):
-  ut = UnitTest.unit_test()
-  ut.change_to_testfile_dir = True
-  ut.run()
-  ut.print_results()
+# loop over all *.c filenames in tests/src to build them all
+# target name is filename.c without the .c
+def build_tests(bld):
+  for target_name in bld.path.ant_glob('tests/src/**/*.c').split():
+    this_target = bld.new_task_gen(
+        features = 'cprogram cc test',
+        source = target_name,
+        target = target_name.split('.')[0],
+        includes = 'src',
+        install_path = None,
+        uselib_local = 'aubio')
+    # phasevoc-jack also needs aubioext
+    if target_name.endswith('test-phasevoc-jack.c'):
+      this_target.includes = ['src', 'ext']
+      this_target.uselib_local = ['aubio', 'aubioext']