0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

SERVER-42656 Add scons targets for building and executing unittests

This commit is contained in:
Mathew Robinson 2019-08-06 18:42:44 -04:00
parent 8c49a9e761
commit feba925e50
No known key found for this signature in database
GPG Key ID: D0C956FD2B0665E1
2 changed files with 32 additions and 2 deletions

View File

@ -1,5 +1,6 @@
"""Pseudo-builders for building and registering benchmarks.
"""
import os
from SCons.Script import Action
def exists(env):
@ -37,7 +38,20 @@ def build_benchmark(env, target, source, **kwargs):
bmEnv.RegisterBenchmark(result[0])
hygienic = bmEnv.GetOption('install-mode') == 'hygienic'
if not hygienic:
bmEnv.Install("#/build/benchmark/", result[0])
installed_test = bmEnv.Install("#/build/benchmark/", result[0])
env.Command(
target="#+{}".format(os.path.basename(installed_test[0].path)),
source=installed_test,
action="${SOURCES[0]}"
)
else:
test_bin_name = os.path.basename(result[0].path)
env.Command(
target="#+{}".format(test_bin_name),
source=["$PREFIX_BINDIR/{}".format(test_bin_name)],
action="${SOURCES[0]}"
)
return result

View File

@ -1,4 +1,6 @@
'''Pseudo-builders for building and registering unit tests.'''
import os
from SCons.Script import Action
@ -39,9 +41,23 @@ def build_cpp_unit_test(env, target, source, **kwargs):
result = env.Program(target, source, **kwargs)
env.RegisterUnitTest(result[0])
hygienic = env.GetOption('install-mode') == 'hygienic'
if not hygienic:
env.Install('#/build/unittests/', result[0])
installed_test = env.Install('#/build/unittests/', result[0])
env.Command(
target="#+{}".format(os.path.basename(installed_test[0].path)),
source=installed_test,
action="${SOURCES[0]}"
)
else:
test_bin_name = os.path.basename(result[0].path)
env.Command(
target="#+{}".format(test_bin_name),
source=["$PREFIX_BINDIR/{}".format(test_bin_name)],
action="${SOURCES[0]}"
)
return result