summaryrefslogtreecommitdiff
path: root/site_scons/site_tools/mongo_unittest.py
diff options
context:
space:
mode:
Diffstat (limited to 'site_scons/site_tools/mongo_unittest.py')
-rw-r--r--site_scons/site_tools/mongo_unittest.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/site_scons/site_tools/mongo_unittest.py b/site_scons/site_tools/mongo_unittest.py
index 9eb087411ef..ec99ab2d45b 100644
--- a/site_scons/site_tools/mongo_unittest.py
+++ b/site_scons/site_tools/mongo_unittest.py
@@ -1,18 +1,19 @@
"""Pseudo-builders for building and registering unit tests.
"""
+from SCons.Script import Action
def exists(env):
return True
+_unittests = []
def register_unit_test(env, test):
- env['UNITTEST_LIST_ENV']._UnitTestList('$UNITTEST_LIST', test)
+ _unittests.append(test.path)
env.Alias('$UNITTEST_ALIAS', test)
def unit_test_list_builder_action(env, target, source):
- print "Generating " + str(target[0])
ofile = open(str(target[0]), 'wb')
try:
- for s in source:
+ for s in _unittests:
print '\t' + str(s)
ofile.write('%s\n' % s)
finally:
@@ -26,18 +27,12 @@ def build_cpp_unit_test(env, target, source, **kwargs):
result = env.Program(target, source, **kwargs)
env.RegisterUnitTest(result[0])
- env.Install("#/build/unittests/", target)
+ env.Install("#/build/unittests/", result[0])
return result
def generate(env):
- # Capture the top level env so we can use it to generate the unit test list file
- # indepenently of which environment CppUnitTest was called in. Otherwise we will get "Two
- # different env" warnings for the unit_test_list_builder_action.
- env['UNITTEST_LIST_ENV'] = env;
- unit_test_list_builder = env.Builder(
- action=env.Action(unit_test_list_builder_action, "Generating $TARGET"),
- multi=True)
- env.Append(BUILDERS=dict(_UnitTestList=unit_test_list_builder))
+ env.Command('$UNITTEST_LIST', env.Value(_unittests),
+ Action(unit_test_list_builder_action, "Generating $TARGET"))
env.AddMethod(register_unit_test, 'RegisterUnitTest')
env.AddMethod(build_cpp_unit_test, 'CppUnitTest')
env.Alias('$UNITTEST_ALIAS', '$UNITTEST_LIST')