1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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')
|