summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-02-13 16:51:29 -0500
committerMathias Stearn <mathias@10gen.com>2017-03-20 18:38:42 -0400
commit7ff63b0de1c76b7559c40ffe43360f4161a94277 (patch)
tree30b99abe041396019cf918f31a7230af8f8ded13 /site_scons
parente4c62ca157aeeed8343d5f2b9a60192d75406f9e (diff)
downloadmongo-7ff63b0de1c76b7559c40ffe43360f4161a94277.tar.gz
SERVER-28325 Clean up dependencies around unit and integration test list files
* The integration_tests alias now depends on the individual tests directly rather than the whole directory. * Both list files now just depend on the list of tests rather than the tests themselves. * The string printed during execution is now evaluated at the right time so we don't need to print it separately. * Fix installing tests to the build/unitests/ directory on windows.
Diffstat (limited to 'site_scons')
-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')