summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--site_scons/site_tools/mongo_integrationtest.py19
-rw-r--r--site_scons/site_tools/mongo_unittest.py19
2 files changed, 14 insertions, 24 deletions
diff --git a/site_scons/site_tools/mongo_integrationtest.py b/site_scons/site_tools/mongo_integrationtest.py
index 43543b9f5f8..ff9a5f451b3 100644
--- a/site_scons/site_tools/mongo_integrationtest.py
+++ b/site_scons/site_tools/mongo_integrationtest.py
@@ -1,18 +1,20 @@
"""Pseudo-builders for building and registering integration tests.
"""
+from SCons.Script import Action
def exists(env):
return True
+_integration_tests = []
def register_integration_test(env, test):
installed_test = env.Install("#/build/integration_tests/", test)
- env['INTEGRATION_TEST_LIST_ENV']._IntegrationTestList('$INTEGRATION_TEST_LIST', installed_test)
+ _integration_tests.append(installed_test[0].path)
+ env.Alias('$INTEGRATION_TEST_ALIAS', installed_test)
def integration_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 _integration_tests:
print '\t' + str(s)
ofile.write('%s\n' % s)
finally:
@@ -29,15 +31,8 @@ def build_cpp_integration_test(env, target, source, **kwargs):
return result
def generate(env):
- # Capture the top level env so we can use it to generate the integration 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['INTEGRATION_TEST_LIST_ENV'] = env;
- integration_test_list_builder = env.Builder(
- action=env.Action(integration_test_list_builder_action, "Generating $TARGET"),
- multi=True)
- env.Append(BUILDERS=dict(_IntegrationTestList=integration_test_list_builder))
+ env.Command('$INTEGRATION_TEST_LIST', env.Value(_integration_tests),
+ Action(integration_test_list_builder_action, "Generating $TARGET"))
env.AddMethod(register_integration_test, 'RegisterIntegrationTest')
env.AddMethod(build_cpp_integration_test, 'CppIntegrationTest')
- env.Alias('$INTEGRATION_TEST_ALIAS', "#/build/integration_tests/")
env.Alias('$INTEGRATION_TEST_ALIAS', '$INTEGRATION_TEST_LIST')
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')