summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Samuels <richard.l.samuels@gmail.com>2022-05-10 12:30:32 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-10 17:36:10 +0000
commit9326ed52793179cafc76694d2c19481fb37ddbe9 (patch)
treea588b1911ec660888abf00a0f8d167a73ad7f146
parenteb274d65a49a9ce1e8a75e2ba25c45fa017b4f9c (diff)
downloadmongo-9326ed52793179cafc76694d2c19481fb37ddbe9.tar.gz
Revert "SERVER-65347 Add testing to ensure that generated ninja files are deterministic"
This reverts commit 561d65eebd69ee00c98e8f19592d9f1eb9798a7e.
-rw-r--r--etc/evergreen.yml6
-rw-r--r--etc/evergreen_yml_components/definitions.yml50
-rw-r--r--evergreen/ninja_determinism_status.sh1
-rw-r--r--evergreen/ninja_determinism_test.sh22
-rw-r--r--site_scons/site_tools/auto_install_binaries.py21
-rw-r--r--site_scons/site_tools/ninja.py55
-rw-r--r--src/mongo/db/SConscript1
-rw-r--r--src/mongo/unittest/SConscript25
8 files changed, 37 insertions, 144 deletions
diff --git a/etc/evergreen.yml b/etc/evergreen.yml
index ff63b8ca081..cf370450776 100644
--- a/etc/evergreen.yml
+++ b/etc/evergreen.yml
@@ -359,7 +359,6 @@ buildvariants:
- name: compile_ninja_TG
distros:
- rhel80-build
- - name: ninja_determinism_TG
- &enterprise-rhel80-dynamic-v4gcc-debug-experimental-template
name: enterprise-rhel80-dynamic-v4gcc-debug-experimental
@@ -1049,9 +1048,6 @@ buildvariants:
- name: compile_ninja_TG
distros:
- windows-vsCurrent-large
- - name: ninja_determinism_TG
- distros:
- - windows-vsCurrent-large
- name: enterprise-windows-cxx20-debug-experimental
display_name: "~ Enterprise Windows C++20 DEBUG"
@@ -1183,7 +1179,6 @@ buildvariants:
tasks:
- name: compile_ninja_next_TG
- name: compile_ninja_TG
- - name: ninja_determinism_TG
- name: enterprise-macos-rosetta-2
display_name: "Enterprise macOS Via Rosetta 2"
@@ -1491,7 +1486,6 @@ buildvariants:
- name: compile_ninja_TG
distros:
- rhel80-xlarge
- - name: ninja_determinism_TG
- &enterprise-rhel-80-64-bit-dynamic-all-feature-flags-required-template
name: enterprise-rhel-80-64-bit-dynamic-all-feature-flags-required
diff --git a/etc/evergreen_yml_components/definitions.yml b/etc/evergreen_yml_components/definitions.yml
index f3d90a2bcc4..e75b4005844 100644
--- a/etc/evergreen_yml_components/definitions.yml
+++ b/etc/evergreen_yml_components/definitions.yml
@@ -2224,7 +2224,7 @@ tasks:
tags: []
commands:
- func: "scons compile"
- vars: &compile-ninja-vars
+ vars:
generating_for_ninja: true
separate_debug: off
task_install_action:
@@ -2271,49 +2271,6 @@ tasks:
targets:
install-core
-- name: ninja_determinism
- tags: []
- commands:
- - command: expansions.update
- params:
- updates:
- - key: generating_for_ninja
- value: "true"
- - key: separate_debug
- value: off
- - key: task_install_action
- value: default
- - key: task_compile_flags
- value: --ninja
- - key: targets
- value: generate-ninja
- - *f_expansions_write
- - command: subprocess.exec
- params:
- binary: bash
- args:
- - "src/evergreen/ninja_determinism_test.sh"
- env:
- repeat: "5"
- - command: s3.put
- params:
- aws_key: ${aws_key}
- aws_secret: ${aws_secret}
- local_file: src/ninja.tgz
- remote_file: ${project}/${build_variant}/${revision}/artifacts/ninja-determinism-${build_id}-${task_name}-${execution}.tgz
- bucket: mciuploads
- permissions: private
- content_type: application/gzip
- display_name: Ninja Determinism Test Artifacts
- visibility: signed
- optional: true
- - command: subprocess.exec
- type: test
- params:
- binary: bash
- args:
- - "src/evergreen/ninja_determinism_status.sh"
-
- name: libdeps_graph_linting
tags: []
commands:
@@ -7381,11 +7338,6 @@ task_groups:
display_name: build.ninja
- <<: *compile_task_group_template
- name: ninja_determinism_TG
- tasks:
- - ninja_determinism
-
-- <<: *compile_task_group_template
name: server_discovery_and_monitoring_json_test_TG
tasks:
- server_discovery_and_monitoring_json_test
diff --git a/evergreen/ninja_determinism_status.sh b/evergreen/ninja_determinism_status.sh
deleted file mode 100644
index 1972cd178e2..00000000000
--- a/evergreen/ninja_determinism_status.sh
+++ /dev/null
@@ -1 +0,0 @@
-exit < src/ninja_determinism.txt
diff --git a/evergreen/ninja_determinism_test.sh b/evergreen/ninja_determinism_test.sh
deleted file mode 100644
index 6d351846b74..00000000000
--- a/evergreen/ninja_determinism_test.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-set -o errexit
-set -o verbose
-
-for i in $(seq 1 $repeat); do
- bash ./src/evergreen/scons_compile.sh
- cd src
- if [ $i == 1 ]; then
- mv build.ninja build.ninja.a
- mv build build.a
- mv scons_stdout.log scons_stdout.log.a
- else
- if ! diff build.ninja build.ninja.a > build.ninja.diff; then
- tar -cvf ninja.tgz build.ninja{,.a} build{,.a} build.ninja.diff scons_stdout.log{,.a}
- echo "1" > ninja_determinism.txt
- exit 0
- fi
- rm -rf build.ninja build build.ninja.diff scons_stdout.log
- fi
- cd ..
-done
-
-echo "0" > src/ninja_determinism.txt
diff --git a/site_scons/site_tools/auto_install_binaries.py b/site_scons/site_tools/auto_install_binaries.py
index fc34fddd8ae..acc248c5229 100644
--- a/site_scons/site_tools/auto_install_binaries.py
+++ b/site_scons/site_tools/auto_install_binaries.py
@@ -270,8 +270,8 @@ def scan_for_transitive_install(node, env, _path):
installed_children = set(
grandchild
- for source in node.sources
- for direct_children in source.children()
+ for child in node.children()
+ for direct_children in child.children()
for grandchild in direct_children.get_executor().get_all_targets()
if direct_children.get_executor() and grandchild.has_builder()
)
@@ -286,9 +286,20 @@ def scan_for_transitive_install(node, env, _path):
child_component = get_component(child)
child_entry = get_alias_map_entry(env, child_component, child_role)
- if component != child_component:
- if child_component != env.get(DEFAULT_COMPONENT):
- entry.dependencies.add(child_entry)
+ # This is where component inheritance happens. We need a default
+ # component for everything so we can store it but if during
+ # transitive scanning we see a child with the default component here
+ # we will move that file to our component. This prevents
+ # over-stepping the DAG bounds since the default component is likely
+ # to be large and an explicitly tagged file is unlikely to depend on
+ # everything in it.
+ if child_component == env.get(DEFAULT_COMPONENT):
+ setattr(node.attributes, COMPONENT, component)
+ for f in auto_installed_files:
+ child_entry.files.discard(f)
+ entry.files.update(auto_installed_files)
+ elif component != child_component:
+ entry.dependencies.add(child_entry)
results.update(auto_installed_files)
diff --git a/site_scons/site_tools/ninja.py b/site_scons/site_tools/ninja.py
index 2fb4b84a107..d069e16382b 100644
--- a/site_scons/site_tools/ninja.py
+++ b/site_scons/site_tools/ninja.py
@@ -31,7 +31,6 @@ import shlex
import tempfile
import textwrap
-from collections import OrderedDict
from glob import glob
from os.path import join as joinpath
from os.path import splitext
@@ -700,8 +699,7 @@ class NinjaState:
if generated_source_files:
generated_sources_alias = "_ninja_generated_sources"
- ninja_sorted_build(
- ninja,
+ ninja.build(
outputs=generated_sources_alias,
rule="phony",
implicit=generated_source_files
@@ -784,9 +782,8 @@ class NinjaState:
)
if remaining_outputs:
- ninja_sorted_build(
- ninja, outputs=sorted(remaining_outputs), rule="phony",
- implicit=first_output,
+ ninja.build(
+ outputs=sorted(remaining_outputs), rule="phony", implicit=first_output,
)
build["outputs"] = first_output
@@ -804,7 +801,7 @@ class NinjaState:
if "inputs" in build:
build["inputs"].sort()
- ninja_sorted_build(ninja, **build)
+ ninja.build(**build)
template_builds = {'rule': "TEMPLATE"}
for template_builder in template_builders:
@@ -824,7 +821,7 @@ class NinjaState:
template_builds[agg_key] = new_val
if template_builds.get("outputs", []):
- ninja_sorted_build(ninja, **template_builds)
+ ninja.build(**template_builds)
# We have to glob the SCons files here to teach the ninja file
# how to regenerate itself. We'll never see ourselves in the
@@ -848,9 +845,8 @@ class NinjaState:
self.env['NINJA_REGENERATE_DEPS'],
)
- ninja_sorted_build(
- ninja,
- outputs=ninja_in_file_path,
+ ninja.build(
+ ninja_in_file_path,
rule="REGENERATE",
variables={
"self": ninja_file_path,
@@ -860,9 +856,8 @@ class NinjaState:
# This sets up a dependency edge between build.ninja.in and build.ninja
# without actually taking any action to transform one into the other
# because we write both files ourselves later.
- ninja_sorted_build(
- ninja,
- outputs=ninja_file_path,
+ ninja.build(
+ ninja_file_path,
rule="NOOP",
inputs=[ninja_in_file_path],
implicit=[__file__],
@@ -871,9 +866,8 @@ class NinjaState:
# If we ever change the name/s of the rules that include
# compile commands (i.e. something like CC) we will need to
# update this build to reflect that complete list.
- ninja_sorted_build(
- ninja,
- outputs="compile_commands.json",
+ ninja.build(
+ "compile_commands.json",
rule="CMD",
pool="console",
implicit=[ninja_file],
@@ -884,10 +878,8 @@ class NinjaState:
},
)
- ninja_sorted_build(
- ninja, outputs="compiledb", rule="phony",
- implicit=["compile_commands.json"],
- order_only=[generated_sources_alias],
+ ninja.build(
+ "compiledb", rule="phony", implicit=["compile_commands.json"], order_only=[generated_sources_alias],
)
# Look in SCons's list of DEFAULT_TARGETS, find the ones that
@@ -956,26 +948,9 @@ def get_comstr(env, action, targets, sources):
return action.genstring(targets, sources, env)
-def ninja_recursive_sorted_dict(build):
- sorted_dict = OrderedDict()
- for key, val in sorted(build.items()):
- if isinstance(val, dict):
- sorted_dict[key] = ninja_recursive_sorted_dict(val)
- elif isinstance(val, list) and key in ('inputs', 'outputs', 'implicit', 'order_only', 'implicit_outputs'):
- sorted_dict[key] = sorted(val)
- else:
- sorted_dict[key] = val
- return sorted_dict
-
-
-def ninja_sorted_build(ninja, **build):
- sorted_dict = ninja_recursive_sorted_dict(build)
- ninja.build(**sorted_dict)
-
-
def get_command_env(env):
"""
- Return a string that sets the environment for any environment variables that
+ Return a string that sets the enrivonment for any environment variables that
differ between the OS environment and the SCons command ENV.
It will be compatible with the default shell of the operating system.
@@ -998,7 +973,7 @@ def get_command_env(env):
windows = env["PLATFORM"] == "win32"
command_env = ""
- for key, value in sorted(scons_specified_env.items()):
+ for key, value in scons_specified_env.items():
# Ensure that the ENV values are all strings:
if is_List(value):
# If the value is a list, then we assume it is a
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index d6a212b8cc8..d47d277d53f 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -2343,7 +2343,6 @@ env.Program(
'$BUILD_DIR/mongo/util/signal_handlers',
'traffic_reader',
],
- AIB_COMPONENT="mongotrafficreader"
)
env.Library(
diff --git a/src/mongo/unittest/SConscript b/src/mongo/unittest/SConscript
index f4d3cf21b7b..b045b3f7429 100644
--- a/src/mongo/unittest/SConscript
+++ b/src/mongo/unittest/SConscript
@@ -28,10 +28,7 @@ utEnv.Library(
'$BUILD_DIR/third_party/shim_pcrecpp',
'$BUILD_DIR/third_party/shim_yaml'
],
- AIB_COMPONENT='unittest',
- AIB_COMPONENTS_EXTRA=[
- 'test',
- ]
+ AIB_COMPONENT='unittests'
)
env.Library(
@@ -48,10 +45,7 @@ env.Library(
'$BUILD_DIR/mongo/db/wire_version',
'$BUILD_DIR/mongo/util/options_parser/options_parser',
],
- AIB_COMPONENT='unittest',
- AIB_COMPONENTS_EXTRA=[
- 'test',
- ]
+ AIB_COMPONENT='unittests'
)
env.Library(
@@ -76,10 +70,7 @@ env.Library(
'$BUILD_DIR/mongo/util/options_parser/options_parser_init',
'$BUILD_DIR/mongo/util/testing_options',
],
- AIB_COMPONENT='integration-test',
- AIB_COMPONENTS_EXTRA=[
- 'test',
- ]
+ AIB_COMPONENT='integration-tests'
)
bmEnv = env.Clone()
@@ -96,10 +87,7 @@ bmEnv.Library(
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/third_party/shim_benchmark',
],
- AIB_COMPONENT='benchmark',
- AIB_COMPONENTS_EXTRA=[
- 'test',
- ]
+ AIB_COMPONENT='benchmarks'
)
env.Library(
@@ -110,10 +98,7 @@ env.Library(
LIBDEPS=[
'$BUILD_DIR/mongo/executor/task_executor_interface',
],
- AIB_COMPONENT='benchmark',
- AIB_COMPONENTS_EXTRA=[
- 'test',
- ]
+ AIB_COMPONENT='benchmarks'
)
env.CppUnitTest(