X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senfscons%2FBoostUnitTests.py;h=f2516f338833f91a5ef7312975d992e531947784;hb=76fe5e8b7de8a71aeb6fe9b1d0ea37d5fa51c87a;hp=7d250ad3ac94c994e5901afcdaeb1d5afea9a792;hpb=ac6a813d9d99f7add4e13aff7a4bcd314d5604a6;p=senf.git
diff --git a/senfscons/BoostUnitTests.py b/senfscons/BoostUnitTests.py
index 7d250ad..f2516f3 100644
--- a/senfscons/BoostUnitTests.py
+++ b/senfscons/BoostUnitTests.py
@@ -1,24 +1,48 @@
+## \file
+# \brief BoostUnitTests build
+
+## \package senfscons.BoostUnitTests
+# \brief Builder utilizing the Boost.Test unit-test framework
+#
+# The BoostUnitTests builder will build a unit-test executable using
+# the Boost.Test
+# library. After building, the unit-test will be executed.
+#
+# This builder is used by the SENFSCons.Object() helper to build the
+# unit test.
+#
+# \par Construction Envrionment Variables:
+#
+# \c BOOSTTESTLIB | Name of the library to use, defaults to \c boost_unit_test_framework |
+# \c BOOSTTESTARGS | Command line arguments of the test, defaults to --build_info=yes --log_level=test_suite |
+#
+#
+# \todo This is not really a builder. This should be rewritten as one
+# \ingroup builder
+
import SCons.Script.SConscript
import SCons.Defaults
import os.path
import os
-def BoostUnitTests(env, target, source, test_source=None, LIBS = [], DEPENDS = [], **kw):
+def BoostUnitTests(env, target, objects, test_sources=None, LIBS = [], OBJECTS = [], DEPENDS = [], **kw):
path, name = os.path.split(target)
- if test_source:
- if type(test_source) is not type([]):
- test_source = [ test_source ]
+ if test_sources:
+ if type(test_sources) is not type([]):
+ test_sources = [ test_sources ]
else:
- test_source = []
+ test_sources = []
testEnv = env.Copy(**kw)
- testEnv.Prepend(LIBS = '$BOOSTTESTLIB')
+ testEnv.Prepend(_LIBFLAGS = ' -Wl,-Bstatic -l$BOOSTTESTLIB -Wl,-Bdynamic ')
testEnv.Prepend(LIBS = LIBS)
- sources = []
- if source:
- sources = sources + env.Object(source)
- sources = sources + test_source
+ testEnv.Append(LIBS = env['TEST_EXTRA_LIBS'])
+ all_objects = []
+ if not objects:
+ objects = []
+ all_objects = objects + env.Object(test_sources) + OBJECTS
binName = os.path.join(path,'.' + name +'.bin')
- testRunner = testEnv.Program(binName, sources)
+ testRunner = testEnv.Program(binName, all_objects)
stamp = os.path.join(path,'.' + os.path.splitext(name)[0]+'.stamp')
if DEPENDS:
env.Depends(testRunner, DEPENDS)
@@ -28,7 +52,7 @@ def BoostUnitTests(env, target, source, test_source=None, LIBS = [], DEPENDS = [
def dispatcher(*arg,**kw):
return BoostUnitTests(*arg,**kw)
-
+
def generate(env):
env['BOOSTTESTLIB'] = 'boost_unit_test_framework'
env['BOOSTTESTARGS'] = [ '--build_info=yes', '--log_level=test_suite' ]