/[escript]/trunk/bruce/test/BruceFactory/SConscript
ViewVC logotype

Annotation of /trunk/bruce/test/BruceFactory/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 357 - (hide annotations)
Wed Dec 14 05:41:24 2005 UTC (15 years, 10 months ago) by jgs
File size: 3224 byte(s)
add explicit target to run unit tests

1 jgs 246 # Scons configuration file for BruceFactory unit tests
2 jgs 195
3     import os
4 jgs 226 import sys
5 jgs 195
6 jgs 226 #
7     # ensure correct versions of python and scons
8 jgs 195
9 jgs 226 EnsurePythonVersion(2,3)
10     EnsureSConsVersion(0,96)
11 jgs 195
12 jgs 226 #
13     # set appropriate defaults for configuration variables
14 jgs 195
15 jgs 226 esysroot = Dir('#../../..')
16     usegcc = 0
17 jgs 246 options = None
18 jgs 253 sys_libs = []
19 jgs 195
20 jgs 226 #
21 jgs 248 # import configuration variables passed in from
22     # calling SConscript (if any)
23    
24     Import('*')
25    
26     #
27 jgs 226 # retreive command-line arguments if any
28 jgs 195
29 jgs 226 if ARGUMENTS.get('usegcc',0):
30     usegcc = 1
31 jgs 195
32 jgs 246 if ARGUMENTS.get('options',0):
33     options = ARGUMENTS.get('options',0)
34    
35 jgs 226 #
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 226
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 226 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 226 cxx_flags=cxx_flags_debug
65    
66     #
67     # print out build configuration for this module
68    
69     print "Build configuration for module: BruceFactory 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 195 bruce_path = str(esysroot) + '/bruce/inc'
80     brucefactory_test_path = str(esysroot) + '/bruce/test/BruceFactory'
81     escript_path = str(esysroot) + '/escript/inc'
82     esysUtils_path = str(esysroot) + '/esysUtils/inc'
83     CppUnitTest_path = str(esysroot) + '/tools/CppUnitTest/inc'
84    
85     esys_lib_path = str(esysroot) + '/lib'
86     esysUtils_lib_path = str(esysroot) + '/esysUtils/lib'
87     CppUnitTest_lib_path = str(esysroot) + '/tools/CppUnitTest/lib'
88    
89 jgs 288 bruce_lib = str(esys_lib_path) + '/libbrucecpp.so'
90    
91     install_dir = str(esysroot) + '/bruce/test'
92    
93 jgs 195 cpp_path = [bruce_path,
94     brucefactory_test_path,
95     escript_path,
96     esysUtils_path,
97     CppUnitTest_path,
98     python_path,
99     boost_path]
100    
101     lib_path = [esys_lib_path,
102     esysUtils_lib_path,
103     CppUnitTest_lib_path,
104     python_lib_path,
105     boost_lib_path]
106    
107     libs = ['brucecpp',
108     'escriptcpp',
109     'esysUtils',
110     'CppUnitTest',
111 jgs 239 str(python_lib),
112     str(boost_lib),
113 jgs 195 'dl',
114 jgs 253 'util']
115 jgs 195
116 jgs 253 libs.extend(sys_libs)
117    
118 jgs 195 sources = ['BruceFactoryTestCase.cpp',
119     'BruceFactoryTest.cpp']
120    
121     target = 'BruceFactoryTest.exe'
122    
123     brucefactory_env = Environment(ENV = os.environ)
124    
125 jgs 226 brucefactory_env.Replace(CXX = cxx)
126 jgs 195 brucefactory_env.Replace(CXXFLAGS = cxx_flags)
127     brucefactory_env.Replace(CPPPATH = cpp_path)
128     brucefactory_env.Replace(LIBPATH = lib_path)
129     brucefactory_env.Replace(LIBS = libs)
130    
131     brucefactory_test_exe = brucefactory_env.Program(target, sources)
132 jgs 288
133     Depends(brucefactory_test_exe, bruce_lib)
134    
135 jgs 355 Alias("build_tests", brucefactory_env.Install(install_dir, brucefactory_test_exe))
136 jgs 297
137     import scons_extensions
138     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)
139     brucefactory_env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
140 jgs 357
141     Alias("run_tests", brucefactory_env.RunUnitTest(target))

  ViewVC Help
Powered by ViewVC 1.1.26