2015-08-04 17:32:19 +02:00
|
|
|
"""Pseudo-builders for building and registering integration tests.
|
|
|
|
"""
|
2017-02-13 22:51:29 +01:00
|
|
|
from SCons.Script import Action
|
2015-08-04 17:32:19 +02:00
|
|
|
|
|
|
|
def exists(env):
|
|
|
|
return True
|
|
|
|
|
2017-02-13 22:51:29 +01:00
|
|
|
_integration_tests = []
|
2015-08-04 17:32:19 +02:00
|
|
|
def register_integration_test(env, test):
|
|
|
|
installed_test = env.Install("#/build/integration_tests/", test)
|
2017-02-13 22:51:29 +01:00
|
|
|
_integration_tests.append(installed_test[0].path)
|
|
|
|
env.Alias('$INTEGRATION_TEST_ALIAS', installed_test)
|
2015-08-04 17:32:19 +02:00
|
|
|
|
|
|
|
def integration_test_list_builder_action(env, target, source):
|
|
|
|
ofile = open(str(target[0]), 'wb')
|
|
|
|
try:
|
2017-02-13 22:51:29 +01:00
|
|
|
for s in _integration_tests:
|
2015-08-04 17:32:19 +02:00
|
|
|
print '\t' + str(s)
|
|
|
|
ofile.write('%s\n' % s)
|
|
|
|
finally:
|
|
|
|
ofile.close()
|
|
|
|
|
|
|
|
def build_cpp_integration_test(env, target, source, **kwargs):
|
|
|
|
libdeps = kwargs.get('LIBDEPS', [])
|
|
|
|
libdeps.append( '$BUILD_DIR/mongo/unittest/integration_test_main' )
|
|
|
|
|
|
|
|
kwargs['LIBDEPS'] = libdeps
|
2018-03-22 08:32:55 +01:00
|
|
|
kwargs['INSTALL_ALIAS'] = ['tests']
|
2015-08-04 17:32:19 +02:00
|
|
|
|
|
|
|
result = env.Program(target, source, **kwargs)
|
|
|
|
env.RegisterIntegrationTest(result[0])
|
|
|
|
return result
|
|
|
|
|
|
|
|
def generate(env):
|
2017-02-13 22:51:29 +01:00
|
|
|
env.Command('$INTEGRATION_TEST_LIST', env.Value(_integration_tests),
|
|
|
|
Action(integration_test_list_builder_action, "Generating $TARGET"))
|
2015-08-04 17:32:19 +02:00
|
|
|
env.AddMethod(register_integration_test, 'RegisterIntegrationTest')
|
|
|
|
env.AddMethod(build_cpp_integration_test, 'CppIntegrationTest')
|
|
|
|
env.Alias('$INTEGRATION_TEST_ALIAS', '$INTEGRATION_TEST_LIST')
|