1 |
jgs |
235 |
# Scons configuration file for DataConstant unit tests |
2 |
jgs |
196 |
|
3 |
|
|
import os |
4 |
jgs |
235 |
import sys |
5 |
jgs |
196 |
|
6 |
jgs |
235 |
# |
7 |
|
|
# ensure correct versions of python and scons |
8 |
jgs |
196 |
|
9 |
jgs |
235 |
EnsurePythonVersion(2,3) |
10 |
|
|
EnsureSConsVersion(0,96) |
11 |
jgs |
196 |
|
12 |
jgs |
235 |
# |
13 |
|
|
# set appropriate defaults for configuration variables |
14 |
jgs |
196 |
|
15 |
jgs |
235 |
esysroot = Dir('#../../..') |
16 |
|
|
usegcc = 0 |
17 |
jgs |
246 |
options = None |
18 |
jgs |
252 |
sys_libs = [] |
19 |
jgs |
196 |
|
20 |
jgs |
235 |
# |
21 |
jgs |
248 |
# import configuration variables passed in from |
22 |
|
|
# calling SConscript (if any) |
23 |
|
|
|
24 |
|
|
Import('*') |
25 |
|
|
|
26 |
|
|
# |
27 |
jgs |
235 |
# retreive command-line arguments if any |
28 |
jgs |
196 |
|
29 |
jgs |
235 |
if ARGUMENTS.get('usegcc',0): |
30 |
|
|
usegcc = 1 |
31 |
jgs |
196 |
|
32 |
jgs |
246 |
if ARGUMENTS.get('options',0): |
33 |
|
|
options = ARGUMENTS.get('options',0) |
34 |
|
|
|
35 |
jgs |
235 |
# |
36 |
|
|
# determine platform |
37 |
|
|
|
38 |
|
|
env = Environment(ENV = os.environ) |
39 |
|
|
platform = env['PLATFORM'] |
40 |
|
|
|
41 |
|
|
# |
42 |
|
|
# determine hostname |
43 |
|
|
|
44 |
jgs |
325 |
import socket |
45 |
|
|
hostname = socket.gethostname() |
46 |
jgs |
235 |
|
47 |
|
|
# |
48 |
|
|
# load configuration settings |
49 |
|
|
|
50 |
|
|
options_dir = str(esysroot) + '/scons' |
51 |
|
|
sys.path.append(options_dir) |
52 |
|
|
|
53 |
jgs |
309 |
from default_options import * |
54 |
|
|
|
55 |
jgs |
235 |
if hostname=='ess': |
56 |
|
|
from ess_options import * |
57 |
|
|
|
58 |
jgs |
241 |
if usegcc==1: |
59 |
|
|
from gcc_options import * |
60 |
|
|
|
61 |
jgs |
246 |
if options!=None: |
62 |
|
|
exec "from " + options + " import *" |
63 |
|
|
|
64 |
jgs |
235 |
cxx_flags=cxx_flags_debug |
65 |
|
|
|
66 |
|
|
# |
67 |
|
|
# print out build configuration for this module |
68 |
|
|
|
69 |
|
|
print "Build configuration for module: DataConstant unit tests" |
70 |
|
|
print " dodebug: 1" |
71 |
|
|
print " usegcc: ", usegcc |
72 |
|
|
print " cxx: ", cxx |
73 |
|
|
print " platform: ", platform |
74 |
|
|
print " hostname: ", hostname |
75 |
|
|
|
76 |
|
|
# |
77 |
|
|
# do the actual build |
78 |
|
|
|
79 |
jgs |
196 |
dataconstant_test_path = str(esysroot) + '/escript/test/DataConstant' |
80 |
|
|
escript_path = str(esysroot) + '/escript/inc' |
81 |
|
|
esysUtils_path = str(esysroot) + '/esysUtils/inc' |
82 |
|
|
CppUnitTest_path = str(esysroot) + '/tools/CppUnitTest/inc' |
83 |
|
|
|
84 |
|
|
esys_lib_path = str(esysroot) + '/lib' |
85 |
|
|
esysUtils_lib_path = str(esysroot) + '/esysUtils/lib' |
86 |
|
|
CppUnitTest_lib_path = str(esysroot) + '/tools/CppUnitTest/lib' |
87 |
|
|
|
88 |
jgs |
288 |
escript_lib = str(esys_lib_path) + '/libescriptcpp.so' |
89 |
|
|
|
90 |
|
|
install_dir = str(esysroot) + '/escript/test' |
91 |
|
|
|
92 |
jgs |
196 |
cpp_path = [dataconstant_test_path, |
93 |
|
|
escript_path, |
94 |
|
|
esysUtils_path, |
95 |
|
|
CppUnitTest_path, |
96 |
|
|
python_path, |
97 |
|
|
boost_path] |
98 |
|
|
|
99 |
|
|
lib_path = [esys_lib_path, |
100 |
|
|
esysUtils_lib_path, |
101 |
|
|
CppUnitTest_lib_path, |
102 |
|
|
python_lib_path, |
103 |
|
|
boost_lib_path] |
104 |
|
|
|
105 |
|
|
libs = ['escriptcpp', |
106 |
|
|
'esysUtils', |
107 |
|
|
'CppUnitTest', |
108 |
jgs |
239 |
str(python_lib), |
109 |
|
|
str(boost_lib), |
110 |
jgs |
196 |
'dl', |
111 |
jgs |
252 |
'util'] |
112 |
jgs |
196 |
|
113 |
jgs |
252 |
libs.extend(sys_libs) |
114 |
|
|
|
115 |
jgs |
196 |
sources = ['DataConstantTestCase.cpp', |
116 |
|
|
'DataConstantTest.cpp'] |
117 |
|
|
|
118 |
|
|
target = 'DataConstantTest.exe' |
119 |
|
|
|
120 |
|
|
dataconstant_env = Environment(ENV = os.environ) |
121 |
|
|
|
122 |
jgs |
235 |
dataconstant_env.Replace(CXX = cxx) |
123 |
jgs |
196 |
dataconstant_env.Replace(CXXFLAGS = cxx_flags) |
124 |
|
|
dataconstant_env.Replace(CPPPATH = cpp_path) |
125 |
|
|
dataconstant_env.Replace(LIBPATH = lib_path) |
126 |
|
|
dataconstant_env.Replace(LIBS = libs) |
127 |
|
|
|
128 |
|
|
dataconstant_test_exe = dataconstant_env.Program(target, sources) |
129 |
jgs |
288 |
|
130 |
|
|
Depends(dataconstant_test_exe, escript_lib) |
131 |
|
|
|
132 |
jgs |
355 |
Alias("build_tests", dataconstant_env.Install(install_dir, dataconstant_test_exe)) |
133 |
jgs |
360 |
|
134 |
|
|
import scons_extensions |
135 |
|
|
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True) |
136 |
|
|
dataconstant_env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder}); |
137 |
|
|
|
138 |
|
|
Alias("run_tests", dataconstant_env.RunUnitTest(target)) |