3 # Copyright (c) 2016 Stefan Seefeld
6 # Distributed under the Boost Software License, Version 1.0.
7 # (See accompanying file LICENSE_1_0.txt or copy at
8 # http://www.boost.org/LICENSE_1_0.txt)
15 if sys.platform == 'win32':
16 # HACK: This works around a bug in SCons.
17 # subprocess.check_output will complain unless all environment
18 # variables are strings.
19 system_root = env['ENV']['SystemRoot']
20 env['ENV']['SystemRoot'] = str(system_root)
23 # libs needed for embedding
24 ELIBS=env['LIBS'] + env['PYTHONLIBS']
26 def BPLTest(env, name, sources = None, deps = None):
27 run = env.BoostRunPythonScript(name + '.py')
29 for source in sources:
31 env.PythonExtension(source != name and source or (source + '_ext'), source + '.cpp')
34 Depends(run, env.PythonExtension(name + '_ext', name + '.cpp'))
39 env.AddMethod(BPLTest)
41 env.AppendENVPath('PYTHONPATH', Dir('.').path)
44 tests+=env.BPLTest('crossmod_exception', ['crossmod_exception_a', 'crossmod_exception_b'])
46 for test in [('injected',),
50 ('boost_shared_ptr',),
51 ('enable_shared_from_this',),
55 ('wrapper_held_type',),
59 ('exception_translator',),
60 ('test_enum', ['enum_ext']),
61 ('test_cltree', ['cltree']),
62 ('newtest', ['m1', 'm2']),
64 ('keywords_test', ['keywords']),
65 ('test_pointer_adoption',),
67 ('operators_wrapper',),
77 ('virtual_functions',),
85 ('multi_arg_constructor',),
86 ('iterator', ['iterator', 'input_iterator']),
89 ('crossmod_opaque', ['crossmod_opaque_a', 'crossmod_opaque_b']),
99 ('vector_indexing_suite',),
100 ('pointer_vector',)]:
101 tests+=env.BPLTest(*test)
107 tests+=env.BPLTest(*test)
110 ('polymorphism2_auto_ptr',),
113 tests+=env.BPLTest(*test)
116 test = env.BoostRunPythonScript('test_builtin_converters.py')
119 env.PythonExtension('builtin_converters_ext', ['builtin_converters.cpp'])
122 test = env.BoostRunPythonScript('map_indexing_suite.py')
125 env.PythonExtension('map_indexing_suite_ext', [
126 'map_indexing_suite.cpp',
127 'int_map_indexing_suite.cpp',
128 'a_map_indexing_suite.cpp'])
132 tests+=env.BoostRunTest('import_', 'import_.cpp', '${SOURCES[0]} ${SOURCES[1]}', 'import_.py', LIBS=ELIBS)
134 tests+=env.BoostCompileTest('indirect_traits_test')
135 tests+=env.BoostRunTests(['destroy_test',
136 'pointer_type_id_test',
140 'result'], LIBS=ELIBS)
142 tests+=env.BoostCompileTests(['string_literal',
145 'copy_ctor_mutates_rhs'])
147 tests+=env.BoostRunTest('upcast', LIBS=ELIBS)
148 tests+=env.BoostCompileTest('select_holder')
149 tests+=env.BoostRunTest('select_from_python_test', LIBS=ELIBS)
150 tests+=env.BoostCompileTest('select_arg_to_python_test')
152 if platform.system() == 'Windows':
153 tests+=env.BPLTest('calling_conventions')
154 tests+=env.BPLTest('calling_conventions_mf')
157 numpy_env = env.Clone()
158 numpy_env.BoostUseLib('numpy')
159 for test in [('numpy/dtype',),
161 ('numpy/templates',),
165 tests+=numpy_env.BPLTest(*test)
168 env.BoostTestSummary(tests)