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:
parent
8c49a9e761
commit
feba925e50
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user