summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Moody <daniel.moody@mongodb.com>2022-05-12 20:42:32 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-12 22:39:36 +0000
commitf73173d32e103c158c21e5b997ea7b413b2b3633 (patch)
treeeda0530bfa338fd7504993cecc321ce5f40cc3c2
parentdf995d36642a75186dfc01198bc0d6f2d1030ce2 (diff)
downloadmongo-f73173d32e103c158c21e5b997ea7b413b2b3633.tar.gz
SERVER-65544 updated build to create a tmpdir for tests to run in.
-rw-r--r--SConstruct12
-rw-r--r--site_scons/site_tools/mongo_test_execution.py10
-rw-r--r--site_scons/site_tools/ninja.py4
3 files changed, 20 insertions, 6 deletions
diff --git a/SConstruct b/SConstruct
index afdaffa166e..38884c00102 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1080,6 +1080,13 @@ env_vars.Add('WINDOWS_OPENSSL_BIN',
help='Sets the path to the openssl binaries for packaging',
default='c:/openssl/bin')
+# TODO SERVER-42170 switch to PathIsDirCreate validator
+env_vars.Add(PathVariable(
+ "LOCAL_TMPDIR",
+ help='Set the TMPDIR when running tests.',
+ default='$BUILD_ROOT/tmp_test_data',
+ validator=PathVariable.PathAccept
+))
# -- Validate user provided options --
# A dummy environment that should *only* have the variables we have set. In practice it has
@@ -1217,6 +1224,11 @@ if get_option('build-tools') == 'next':
env = Environment(variables=env_vars, **envDict)
del envDict
+# TODO SERVER-42170 We can remove this Execute call
+# when support for PathIsDirCreate can be used as a validator
+# to the Variable above.
+env.Execute(SCons.Defaults.Mkdir(env.Dir('$LOCAL_TMPDIR')))
+
if get_option('cache-signature-mode') == 'validate':
validate_cache_dir = Tool('validate_cache_dir')
if validate_cache_dir.exists(env):
diff --git a/site_scons/site_tools/mongo_test_execution.py b/site_scons/site_tools/mongo_test_execution.py
index 10afeca1c0c..2527ba63a12 100644
--- a/site_scons/site_tools/mongo_test_execution.py
+++ b/site_scons/site_tools/mongo_test_execution.py
@@ -58,7 +58,9 @@ def generate_test_execution_aliases(env, test):
target_name = os.path.basename(installed[0].path)
- target_command = env.Command(
+ test_env = env.Clone()
+ test_env['ENV']['TMPDIR'] = test_env.Dir('$LOCAL_TMPDIR').abspath
+ target_command = test_env.Command(
target=f"#+{target_name}",
source=installed[0],
action="$( $ICERUN $) ${SOURCES[0]} $UNITTEST_FLAGS",
@@ -85,7 +87,7 @@ def generate_test_execution_aliases(env, test):
# We always create the verbose command, but we only create the legacy
# command if there isn't a conflict between the target_name and
# source_name. Legacy commands must be unique
- verbose_source_command = env.Command(
+ verbose_source_command = test_env.Command(
target=f"#+{target_name}-{source_name}",
source=installed[0],
action="$( $ICERUN $) ${SOURCES[0]} -fileNameFilter $TEST_SOURCE_FILE_NAME $UNITTEST_FLAGS",
@@ -102,7 +104,7 @@ def generate_test_execution_aliases(env, test):
if len(alias[0].children()) > 1:
raise SCons.Errors.BuildError(alias[0].children()[0], f"Multiple unit test programs contain a source file named '{source_name}' which would result in an ambiguous test execution alias. Unit test source filenames are required to be globally unique.")
- proof_generator_command = env.Command(
+ proof_generator_command = test_env.Command(
target=[
'${SOURCE}.log',
'${SOURCE}.status',
@@ -123,7 +125,7 @@ def generate_test_execution_aliases(env, test):
env.NoCache(proof_generator_command)
env.AlwaysBuild(proof_generator_command)
- proof_analyzer_command = env.Command(
+ proof_analyzer_command = test_env.Command(
target='${SOURCES[1].base}.proof',
source=proof_generator_command,
action=SCons.Action.Action(
diff --git a/site_scons/site_tools/ninja.py b/site_scons/site_tools/ninja.py
index 27b59a69538..ca35d8659b0 100644
--- a/site_scons/site_tools/ninja.py
+++ b/site_scons/site_tools/ninja.py
@@ -79,8 +79,8 @@ def _mkdir_action_function(env, node):
# to an invalid ninja file.
"variables": {
# On Windows mkdir "-p" is always on
- "cmd": "{mkdir} $out".format(
- mkdir="mkdir" if env["PLATFORM"] == "win32" else "mkdir -p",
+ "cmd": "mkdir {args}".format(
+ args = ' '.join(get_outputs(node)) + " & exit /b 0" if env["PLATFORM"] == "win32" else "-p " + ' '.join(get_outputs(node)),
),
},
}