Add unit test runner (artest) and a config option to run tests after builds
authorSakari Bergen <sakari.bergen@beatwaves.net>
Wed, 8 Jan 2014 20:00:34 +0000 (22:00 +0200)
committerSakari Bergen <sakari.bergen@beatwaves.net>
Wed, 8 Jan 2014 20:00:34 +0000 (22:00 +0200)
gtk2_ardour/artest [new file with mode: 0755]
wscript

diff --git a/gtk2_ardour/artest b/gtk2_ardour/artest
new file mode 100755 (executable)
index 0000000..cd2a55c
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+. `dirname "$0"`/../build/gtk2_ardour/ardev_common_waf.sh
+
+LIBS_DIR=$TOP/build/libs
+
+run_tests () {
+  echo ""
+  echo "-------------------------------------------"
+  echo "Running tests for $1..."
+  echo "-------------------------------------------"
+  echo ""
+  $2 $LIBS_DIR/$1/run-tests
+  echo ""
+}
+
+if [ $# -gt 0 ]; then
+       run_tests $1 $2
+       exit
+fi
+
+run_tests audiographer
+run_tests midi++2
+run_tests evoral
+run_tests pbd
+run_tests ardour
diff --git a/wscript b/wscript
index 855d69486702c8bd009f91149a04ebbb4e4c7d3e..ae4b85e61dba0a1b661bf76db22ee2e41c3522dd 100644 (file)
--- a/wscript
+++ b/wscript
@@ -481,6 +481,8 @@ def options(opt):
                     help='Raise a floating point exception if a denormal is detected')
     opt.add_option('--test', action='store_true', default=False, dest='build_tests',
                     help="Build unit tests")
+    opt.add_option('--run-tests', action='store_true', default=False, dest='run_tests',
+                    help="Run tests after build")
     opt.add_option('--single-tests', action='store_true', default=False, dest='single_tests',
                     help="Build a single executable for each unit test")
     #opt.add_option('--tranzport', action='store_true', default=False, dest='tranzport',
@@ -681,7 +683,8 @@ def configure(conf):
         conf.define('ENABLE_NLS', 1)
         conf.env['ENABLE_NLS'] = True
     if opts.build_tests:
-        conf.env['BUILD_TESTS'] = opts.build_tests
+        conf.env['BUILD_TESTS'] = True
+        conf.env['RUN_TESTS'] = opts.run_tests
     if opts.single_tests:
         conf.env['SINGLE_TESTS'] = opts.single_tests
     #if opts.tranzport:
@@ -801,6 +804,9 @@ def build(bld):
 
     bld.install_files (os.path.join(bld.env['SYSCONFDIR'], 'ardour3', ), 'ardour_system.rc')
 
+    if bld.env['RUN_TESTS']:
+        bld.add_post_fun(test)
+
 def i18n(bld):
     bld.recurse (i18n_children)
 
@@ -815,3 +821,6 @@ def i18n_mo(bld):
 
 def tarball(bld):
     create_stored_revision()
+
+def test(bld):
+    subprocess.call("gtk2_ardour/artest")