~vcs-imports/escript-finley/trunk

« back to all changes in this revision

Viewing changes to escript/test/SConscript

  • Committer: jfenwick
  • Date: 2010-10-11 01:48:14 UTC
  • Revision ID: svn-v4:77569008-7704-0410-b7a0-a92fef0b09fd:trunk:3259
Merging dudley and scons updates from branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#
12
12
########################################################
13
13
 
14
 
 
15
 
import os, re
 
14
import re
16
15
Import('*')
17
 
 
18
 
local_env = clone_env(env_mpi)
19
 
 
20
 
src_dir = local_env.Dir('.').srcnode().abspath
21
 
 
22
 
# get the relevant file names:
23
 
src_dir = local_env.Dir('.').srcnode().abspath
24
 
filenames = [ x for x in os.listdir(src_dir) if os.path.splitext(x)[1] in [".h", ".c", ".cpp"] ]
25
 
 
26
 
sources = [x for x in filenames if os.path.splitext(x)[1] in ['.cpp', '.c']]
27
 
 
28
 
local_env.Append(LIBS= ['escript', 'esysUtils', 'CppUnitTest'] + local_env['sys_libs'] )
29
 
local_env['CCFLAGS'] = re.sub("-O[0-9]", "-g", str(local_env['CCFLAGS']))       # Some of these test files are too large to optimize
30
 
 
31
 
program = local_env.Program('escript_UnitTest', sources)
32
 
 
33
 
#Add Unit Test to target alias
34
 
 
35
 
local_env.Alias('build_tests', program)
 
16
local_env = env.Clone()
 
17
 
 
18
# get the test source file names
 
19
sources = Glob('*.cpp')+Glob('*.c')
 
20
testname='escript_UnitTest'
 
21
 
 
22
# build the executable
 
23
local_env.Append(LIBS=['escript', 'esysUtils', 'CppUnitTest'])
 
24
# some of these test files are too large to optimize
 
25
local_env['CCFLAGS'] = re.sub('-O[0-9]', '-g', str(local_env['CCFLAGS']))
 
26
program = local_env.Program(testname, sources)
36
27
 
37
28
# run the tests - but only if test_targets are stale
38
 
local_env.RunUnitTest('escript_UnitTest')
39
 
test_targets = os.path.splitext('escript_UnitTest')[0]+'.passed'
40
 
Alias("run_tests", test_targets)
41
 
 
42
 
# Add a group of tests
 
29
local_env.RunUnitTest(testname)
 
30
 
 
31
# add unit test to target alias
 
32
Alias('build_tests', program)
 
33
Alias("run_tests", testname+'.passed')
 
34
 
 
35
# configure python unit tests
 
36
local_env.SConscript(dirs = ['#/escript/test/python'], variant_dir='python', duplicate=0, exports=['py_wrapper_lib'])
 
37
 
 
38
# add a group of tests
43
39
from grouptest import *
44
 
tgroup=GroupTest("$BINRUNNER ", (),"","$BUILD_DIR/escript/test",('./escript_UnitTest',))
 
40
tgroup=GroupTest("$BINRUNNER ", (), "", "$BUILD_DIR/escript/test", ('./'+testname,))
45
41
TestGroups.append(tgroup)
46
42
 
47
 
CallSConscript(local_env,dirs = ['#/escript/test/python'], variant_dir='python', duplicate=0)