diff options
author | Adam Midvidy <amidvidy@gmail.com> | 2015-08-04 11:32:19 -0400 |
---|---|---|
committer | Adam Midvidy <amidvidy@gmail.com> | 2015-08-11 13:50:17 -0400 |
commit | a56ea15c45ad9d705db01f2bd607a42a6f3875e9 (patch) | |
tree | 695bf9c30e324379bf833cf1cd24e6689c364380 /site_scons | |
parent | 3f8b8b495fbe5303bb39dcd2ba5708275f482d2e (diff) | |
download | mongo-a56ea15c45ad9d705db01f2bd607a42a6f3875e9.tar.gz |
SERVER-19447 implement SCons support for CPP integration tests
- add evergreen tasks as well
Diffstat (limited to 'site_scons')
-rw-r--r-- | site_scons/site_tools/mongo_integrationtest.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/site_scons/site_tools/mongo_integrationtest.py b/site_scons/site_tools/mongo_integrationtest.py new file mode 100644 index 00000000000..ad87ef8c0f8 --- /dev/null +++ b/site_scons/site_tools/mongo_integrationtest.py @@ -0,0 +1,50 @@ +"""Pseudo-builders for building and registering integration tests. +""" + +def exists(env): + return True + +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) + +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: + 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' ) + + includeCrutch = True + if "NO_CRUTCH" in kwargs: + includeCrutch = not kwargs["NO_CRUTCH"] + + if includeCrutch: + libdeps.append( '$BUILD_DIR/mongo/unittest/unittest_crutch' ) + + kwargs['LIBDEPS'] = libdeps + + result = env.Program(target, source, **kwargs) + env.RegisterIntegrationTest(result[0]) + 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.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') |