2020-04-22 17:38:25 +02:00
|
|
|
# Copyright 2020 MongoDB Inc.
|
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
# a copy of this software and associated documentation files (the
|
|
|
|
# "Software"), to deal in the Software without restriction, including
|
|
|
|
# without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
# permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
# the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included
|
|
|
|
# in all copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
|
|
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
|
|
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
#
|
|
|
|
|
2020-01-07 19:48:42 +01: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
|
|
|
|
2020-08-27 08:03:22 +02:00
|
|
|
from site_scons.mongo import insort_wrapper
|
2020-01-07 19:48:42 +01:00
|
|
|
|
2015-08-04 17:32:19 +02:00
|
|
|
def exists(env):
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
def build_cpp_integration_test(env, target, source, **kwargs):
|
2020-06-26 17:59:44 +02:00
|
|
|
libdeps = kwargs.get("LIBDEPS", env.get("LIBDEPS", [])).copy()
|
2020-08-27 08:03:22 +02:00
|
|
|
insort_wrapper(libdeps, "$BUILD_DIR/mongo/unittest/integration_test_main")
|
2015-08-04 17:32:19 +02:00
|
|
|
|
2020-01-07 19:48:42 +01:00
|
|
|
kwargs["LIBDEPS"] = libdeps
|
|
|
|
integration_test_components = {"tests", "integration-tests"}
|
2019-07-02 19:45:15 +02:00
|
|
|
|
2020-01-06 21:47:18 +01:00
|
|
|
primary_component = kwargs.get("AIB_COMPONENT", env.get("AIB_COMPONENT", ""))
|
|
|
|
if primary_component and not primary_component.endswith("-test"):
|
2020-01-07 19:48:42 +01:00
|
|
|
kwargs["AIB_COMPONENT"] += "-test"
|
2020-01-06 21:47:18 +01:00
|
|
|
elif primary_component:
|
|
|
|
kwargs["AIB_COMPONENT"] = primary_component
|
|
|
|
else:
|
|
|
|
kwargs["AIB_COMPONENT"] = "integration-tests"
|
|
|
|
integration_test_components = {"tests"}
|
2019-07-02 19:45:15 +02:00
|
|
|
|
2020-01-07 19:48:42 +01:00
|
|
|
if "AIB_COMPONENTS_EXTRA" in kwargs:
|
|
|
|
kwargs["AIB_COMPONENTS_EXTRA"] = set(kwargs["AIB_COMPONENTS_EXTRA"]).union(
|
|
|
|
integration_test_components
|
|
|
|
)
|
2019-07-02 19:45:15 +02:00
|
|
|
else:
|
2020-11-06 08:58:47 +01:00
|
|
|
kwargs["AIB_COMPONENTS_EXTRA"] = list(integration_test_components)
|
2015-08-04 17:32:19 +02:00
|
|
|
|
|
|
|
result = env.Program(target, source, **kwargs)
|
2020-01-07 19:48:42 +01:00
|
|
|
env.RegisterTest("$INTEGRATION_TEST_LIST", result[0])
|
|
|
|
env.Alias("$INTEGRATION_TEST_ALIAS", result[0])
|
|
|
|
|
2015-08-04 17:32:19 +02:00
|
|
|
return result
|
|
|
|
|
2019-02-19 16:50:57 +01:00
|
|
|
|
2015-08-04 17:32:19 +02:00
|
|
|
def generate(env):
|
2020-01-07 19:48:42 +01:00
|
|
|
env.TestList("$INTEGRATION_TEST_LIST", source=[])
|
|
|
|
env.AddMethod(build_cpp_integration_test, "CppIntegrationTest")
|
|
|
|
env.Alias("$INTEGRATION_TEST_ALIAS", "$INTEGRATION_TEST_LIST")
|