From deec68422cd0d787b64a554d5438b8334d908f76 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 7 Sep 2008 23:43:06 +0200 Subject: [PATCH] scons: simplify how library tests are built --- tests/SConscript | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/SConscript b/tests/SConscript index e662ca044..0abf7d393 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -5,6 +5,7 @@ from os import path from Buildhelper import srcSubtree +from Buildhelper import scanSubtree from Buildhelper import globRootdirs Import('env','artifacts','core') @@ -31,6 +32,15 @@ def testExecutable(env,tree, exeName=None, obj=None): return env.Program('#$BINDIR/'+exeName, obj + core) +def testCollection(env,dir): + """ treat a Directory containing a collection of standalone tests. + Link each of them into an independent executable + """ + exeName = lambda p: path.basename(path.splitext(p)[0]) + buildIt = lambda p: env.Program("#$BINDIR/"+exeName(p), [p] + core) + return [buildIt(f) for f in scanSubtree(dir)] + + def treatPluginTestcase(env): """ Special case: the test-plugin executable """ @@ -56,19 +66,14 @@ def treatPluginTestcase(env): moduledirs = globRootdirs('*') # but have to treat some subdirs individually. -specials = ['plugin','locking','library','backend'] +specials = ['plugin','library','backend'] artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in moduledirs if not dir in specials] + treatPluginTestcase(env) - + testExecutable(env, 'locking', obj=['test-locking.c','mutex.c','condition.c']) - + testExecutable(env, 'library', exeName='test-llist', obj=['test-llist.c']) - + testExecutable(env, 'library', exeName='test-references', obj=['test-references.c']) - + testExecutable(env, 'library', exeName='test-safeclib', obj=['test-safeclib.c']) - + testExecutable(env, 'library', exeName='test-uuid', obj=['test-uuid.c']) - + testExecutable(env, 'backend', exeName='test-filedescriptors', obj=['test-filedescriptors.c']) - + testExecutable(env, 'backend', exeName='test-filehandles', obj=['test-filehandles.c']) + + testCollection(env, 'library') + + testCollection(env, 'backend') )