Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCons script fails with template CXXTEST_OPTS #125

Open
uphoffc opened this issue Nov 6, 2015 · 0 comments
Open

SCons script fails with template CXXTEST_OPTS #125

uphoffc opened this issue Nov 6, 2015 · 0 comments

Comments

@uphoffc
Copy link

uphoffc commented Nov 6, 2015

Hi,

if you specify a template, e.g. with
env['CXXTEST_OPTS'] = '--template=' + Dir('.').srcnode().abspath + '/src/tests/mpirunner.tpl'
and then use multiple test suites, e.g.
env.CxxTest(target='#/build/parallel_test_suite',source=['test1.t.h' ,'test2.t.h'])
the linker will fail because mutiple main() are defined.

The reason for this lies in lines 374-379 in build_tools/SCons/cxxtest.py:
deps.append(env.CxxTestCpp(headers.pop(0), *_kwargs))
deps.extend(
[env.CxxTestCpp(header, CXXTEST_RUNNER = 'none',
CXXTEST_ROOT_PART = '--part', *_kwargs)
for header in headers]
)
The "second" test suite gets the option cxxtest_runner='none' which prevents the generation of another main. If you use a template, however, cxxtest_runner has no effect and a main will be generated according to the template.

We fixed this in our project by adding CXXTEST_OPTS = ''. However, a better solution would be to filter --template from CXXTEST_OPTS and add CXXTEST_OPTS = filteredOpts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant