summaryrefslogtreecommitdiff
path: root/site_scons/site_tools/mongo_integrationtest.py
diff options
context:
space:
mode:
authorMathew Robinson <mathew.robinson@mongodb.com>2020-01-07 18:48:42 +0000
committerevergreen <evergreen@mongodb.com>2020-01-07 18:48:42 +0000
commit16207c4fa75a8045f24126d768b0ba2e1ce32b1f (patch)
tree6df377ef6da81df1637ccaf95f40354f19af53d4 /site_scons/site_tools/mongo_integrationtest.py
parent71658c0e2edb8c900ced5098f3f5a146a2d649ea (diff)
downloadmongo-16207c4fa75a8045f24126d768b0ba2e1ce32b1f.tar.gz
SERVER-44947 Allow test execution selection by test source file name
Diffstat (limited to 'site_scons/site_tools/mongo_integrationtest.py')
-rw-r--r--site_scons/site_tools/mongo_integrationtest.py55
1 files changed, 21 insertions, 34 deletions
diff --git a/site_scons/site_tools/mongo_integrationtest.py b/site_scons/site_tools/mongo_integrationtest.py
index 95e3b3b8d77..4cc89fc57bd 100644
--- a/site_scons/site_tools/mongo_integrationtest.py
+++ b/site_scons/site_tools/mongo_integrationtest.py
@@ -1,51 +1,38 @@
-'''Pseudo-builders for building and registering integration tests.
-'''
+"""
+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)
- _integration_tests.append(installed_test[0].path)
- env.Alias('$INTEGRATION_TEST_ALIAS', installed_test)
-
-def integration_test_list_builder_action(env, target, source):
- ofile = open(str(target[0]), 'w')
- try:
- for s in _integration_tests:
- 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' )
+ libdeps = kwargs.get("LIBDEPS", [])
+ libdeps.append("$BUILD_DIR/mongo/unittest/integration_test_main")
- kwargs['LIBDEPS'] = libdeps
- integration_test_components = {'tests', 'integration-tests'}
+ kwargs["LIBDEPS"] = libdeps
+ integration_test_components = {"tests", "integration-tests"}
- if (
- 'AIB_COMPONENT' in kwargs
- and not kwargs['AIB_COMPONENT'].endswith('-test')
- ):
- kwargs['AIB_COMPONENT'] += '-test'
+ if "AIB_COMPONENT" in kwargs and not kwargs["AIB_COMPONENT"].endswith("-test"):
+ kwargs["AIB_COMPONENT"] += "-test"
- if 'AIB_COMPONENTS_EXTRA' in kwargs:
- kwargs['AIB_COMPONENTS_EXTRA'] = set(kwargs['AIB_COMPONENTS_EXTRA']).union(integration_test_components)
+ if "AIB_COMPONENTS_EXTRA" in kwargs:
+ kwargs["AIB_COMPONENTS_EXTRA"] = set(kwargs["AIB_COMPONENTS_EXTRA"]).union(
+ integration_test_components
+ )
else:
- kwargs['AIB_COMPONENTS_EXTRA'] = integration_test_components
+ kwargs["AIB_COMPONENTS_EXTRA"] = integration_test_components
result = env.Program(target, source, **kwargs)
- env.RegisterIntegrationTest(result[0])
+ env.RegisterTest("$INTEGRATION_TEST_LIST", result[0])
+ env.Alias("$INTEGRATION_TEST_ALIAS", result[0])
+
return result
def generate(env):
- 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', '$INTEGRATION_TEST_LIST')
+ env.TestList("$INTEGRATION_TEST_LIST", source=[])
+ env.AddMethod(build_cpp_integration_test, "CppIntegrationTest")
+ env.Alias("$INTEGRATION_TEST_ALIAS", "$INTEGRATION_TEST_LIST")