mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 01:21:03 +01:00
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.
This commit is contained in:
parent
e4c62ca157
commit
7ff63b0de1
@ -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')
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user