Skip to content

Commit 6b5aab0

Browse files
ADAM Martinevergreen
authored andcommitted
SERVER-43047 Make "registered" unit tests also run by @ prefix.
1 parent 09b4914 commit 6b5aab0

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

site_scons/site_tools/mongo_unittest.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ def exists(env):
1111
_unittests = []
1212
def register_unit_test(env, test):
1313
_unittests.append(test.path)
14+
15+
hygienic = env.GetOption('install-mode') == 'hygienic'
16+
if hygienic and getattr(test.attributes, "AIB_INSTALL_ACTIONS", []):
17+
installed = getattr(test.attributes, "AIB_INSTALL_ACTIONS")
18+
else:
19+
installed = [test]
20+
21+
env.Command(
22+
target="#@{}".format(os.path.basename(installed[0].get_path())),
23+
source=installed,
24+
action="${SOURCES[0]}"
25+
)
26+
1427
env.Alias('$UNITTEST_ALIAS', test)
1528

1629
def unit_test_list_builder_action(env, target, source):
@@ -42,22 +55,6 @@ def build_cpp_unit_test(env, target, source, **kwargs):
4255
result = env.Program(target, source, **kwargs)
4356
env.RegisterUnitTest(result[0])
4457

45-
hygienic = env.GetOption('install-mode') == 'hygienic'
46-
if not hygienic:
47-
installed_test = env.Install('#/build/unittests/', result[0])
48-
env.Command(
49-
target="#@{}".format(os.path.basename(installed_test[0].path)),
50-
source=installed_test,
51-
action="${SOURCES[0]}"
52-
)
53-
else:
54-
test_bin_name = os.path.basename(result[0].path)
55-
env.Command(
56-
target="#@{}".format(test_bin_name),
57-
source=["$PREFIX_BINDIR/{}".format(test_bin_name)],
58-
action="${SOURCES[0]}"
59-
)
60-
6158
return result
6259

6360

0 commit comments

Comments
 (0)