1 |
Import('*') |
2 |
|
3 |
program_name = 'escript_UnitTest' |
4 |
|
5 |
local_env=env.Copy() |
6 |
|
7 |
src_dir = local_env.Dir('.').srcnode().abspath |
8 |
|
9 |
import os |
10 |
# get the relevant file names: |
11 |
src_dir = local_env.Dir('.').srcnode().abspath |
12 |
filenames = [ x for x in os.listdir(src_dir) if os.path.splitext(x)[1] in [".h", ".c", ".cpp"] ] |
13 |
|
14 |
sources = [x for x in filenames if os.path.splitext(x)[1] in ['.cpp', '.c']] |
15 |
|
16 |
local_env.Append(LIBS= [python_lib] + [boost_lib] + ['escript', 'esysUtils', 'CppUnitTest'] + sys_libs ) |
17 |
if useNetCDF == 'yes': |
18 |
local_env.Append(LIBS = netCDF_libs) |
19 |
local_env.Append(CPPDEFINES = [ 'USE_NETCDF' ]) |
20 |
if IS_WINDOWS_PLATFORM: local_env.Append(CPPDEFINES = [ 'DLL_NETCDF' ]) |
21 |
|
22 |
program = local_env.Program(program_name, sources) |
23 |
|
24 |
#Add Unit Test to target alias |
25 |
|
26 |
env.Alias('run_tests', program) |
27 |
|
28 |
# run the tests - but only if test_targets are stale |
29 |
local_env.RunUnitTest(program_name) |
30 |
test_targets = os.path.splitext(program_name)[0]+'.passed' |
31 |
Alias("run_tests", test_targets) |
32 |
|
33 |
release_srcfiles = [ env.File("SConscript"), ] |
34 |
release_testfiles = [ env.File(x) for x in filenames ] |
35 |
env.Zip(src_zipfile, release_srcfiles) |
36 |
env.Zip(test_zipfile, release_testfiles) |
37 |
try: |
38 |
env.Tar(src_tarfile, release_srcfiles) |
39 |
env.Tar(test_tarfile, release_testfiles) |
40 |
except AttributeError: |
41 |
pass |
42 |
|
43 |
local_env.SConscript(dirs = ['#/escript/test/python'], build_dir='python', duplicate=0) |