Skip to content

Commit 1bfd8f8

Browse files
committed
DEV: make sure test program builds with our library.
Require our own build of `libdiffpy` for the `alltests` program, but do not do so when `test_installed` flag is on.
1 parent 7edfb66 commit 1bfd8f8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/tests/SConscript

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ if env['test_installed']:
1111
# build unit tests for the installed library
1212
env_test['CPPPATH'].remove(Dir('..'))
1313
env_test.PrependUnique(CPPPATH=env['includedir'], delete_existing=1)
14-
env_test['lib_includes'] = []
1514
lib_dir = env['libdir']
1615
else:
17-
# build unit tests for this code repository
16+
# link unit tests with our library.
1817
Import('libdiffpy')
1918
lib_dir = libdiffpy[0].dir.abspath
19+
use_our_library = not env['test_installed']
2020

2121
env_test.PrependUnique(LIBS='diffpy', LIBPATH=lib_dir, delete_existing=1)
2222
env_test.PrependUnique(LINKFLAGS="-Wl,-rpath,%r" % lib_dir)
@@ -54,10 +54,13 @@ test_helpers = thobj + ['objcryst_helpers.cpp']
5454
test_helpers = filter(srcsupported, test_helpers)
5555

5656
alltests = env_test.CxxTest('alltests', test_sources + test_helpers)
57-
Alias('alltests', [alltests, env['lib_includes']])
57+
if use_our_library:
58+
env_test.Depends(alltests, libdiffpy)
59+
60+
env_test.Alias('alltests', alltests)
5861

5962
# test -- alias for executing unit tests.
60-
test = env_test.Alias('test', 'alltests', alltests[0].abspath)
63+
test = env_test.Alias('test', alltests, alltests[0].abspath)
6164
AlwaysBuild(test)
6265

6366
# vim: ft=python

0 commit comments

Comments
 (0)