mirror of https://github.com/mongodb/mongo
SERVER-104716 add bazel compiledb evergreen testing (#35759)
GitOrigin-RevId: 6fbe0bdde8caddb06094bb7f88953df5efd41d25
This commit is contained in:
parent
5039d3e7b3
commit
1599044820
|
|
@ -193,6 +193,7 @@ WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot
|
||||||
# The following patterns are parsed from ./evergreen/OWNERS.yml
|
# The following patterns are parsed from ./evergreen/OWNERS.yml
|
||||||
/evergreen/**/restore_git_history_and_tags.sh @10gen/devprod-correctness @svc-auto-approve-bot
|
/evergreen/**/restore_git_history_and_tags.sh @10gen/devprod-correctness @svc-auto-approve-bot
|
||||||
/evergreen/**/retry_git.sh @10gen/devprod-correctness @svc-auto-approve-bot
|
/evergreen/**/retry_git.sh @10gen/devprod-correctness @svc-auto-approve-bot
|
||||||
|
/evergreen/**/validate_compile_commands.py @10gen/devprod-build @svc-auto-approve-bot
|
||||||
|
|
||||||
# The following patterns are parsed from ./jstests/OWNERS.yml
|
# The following patterns are parsed from ./jstests/OWNERS.yml
|
||||||
/jstests/**/*analyze_shard_key* @10gen/server-cluster-scalability @svc-auto-approve-bot
|
/jstests/**/*analyze_shard_key* @10gen/server-cluster-scalability @svc-auto-approve-bot
|
||||||
|
|
|
||||||
|
|
@ -105,19 +105,6 @@ variables:
|
||||||
- func: "run hang analyzer"
|
- func: "run hang analyzer"
|
||||||
- func: "wait for resmoke to shutdown"
|
- func: "wait for resmoke to shutdown"
|
||||||
|
|
||||||
- &clang_tidy_task_template
|
|
||||||
tags:
|
|
||||||
[
|
|
||||||
"assigned_to_jira_team_devprod_build",
|
|
||||||
"development_critical_single_variant",
|
|
||||||
"requires_large_host",
|
|
||||||
"clang_tidy",
|
|
||||||
]
|
|
||||||
exec_timeout_secs: 7200 # 1 hour timeout for the task overall
|
|
||||||
depends_on:
|
|
||||||
- name: version_expansions_gen
|
|
||||||
variant: generate-tasks-for-version
|
|
||||||
|
|
||||||
# TODO: split this up into the user files.
|
# TODO: split this up into the user files.
|
||||||
# List of all variants that make mongocryptd
|
# List of all variants that make mongocryptd
|
||||||
# If a variant is listed here and has a push task, mongocryptd is pushed
|
# If a variant is listed here and has a push task, mongocryptd is pushed
|
||||||
|
|
@ -318,8 +305,18 @@ tasks:
|
||||||
--keep_going
|
--keep_going
|
||||||
--build_tag_filters=${bazel_filters_for_cache_hydration}
|
--build_tag_filters=${bazel_filters_for_cache_hydration}
|
||||||
|
|
||||||
- <<: *clang_tidy_task_template
|
- name: run_bazel_clang_tidy
|
||||||
name: run_bazel_clang_tidy
|
tags:
|
||||||
|
[
|
||||||
|
"assigned_to_jira_team_devprod_build",
|
||||||
|
"development_critical_single_variant",
|
||||||
|
"requires_large_host",
|
||||||
|
"clang_tidy",
|
||||||
|
]
|
||||||
|
exec_timeout_secs: 1800 # 30 min timeout for the task overall
|
||||||
|
depends_on:
|
||||||
|
- name: version_expansions_gen
|
||||||
|
variant: generate-tasks-for-version
|
||||||
commands:
|
commands:
|
||||||
- func: "do bazel setup"
|
- func: "do bazel setup"
|
||||||
- func: "bazel compile"
|
- func: "bazel compile"
|
||||||
|
|
@ -329,6 +326,26 @@ tasks:
|
||||||
bazel_args: --config=clang-tidy --mongo_toolchain_version=${clang_tidy_toolchain|v5} --keep_going
|
bazel_args: --config=clang-tidy --mongo_toolchain_version=${clang_tidy_toolchain|v5} --keep_going
|
||||||
- func: "generate clang-tidy report"
|
- func: "generate clang-tidy report"
|
||||||
|
|
||||||
|
- name: run_bazel_compiledb
|
||||||
|
tags:
|
||||||
|
[
|
||||||
|
"assigned_to_jira_team_devprod_build",
|
||||||
|
"development_critical_single_variant",
|
||||||
|
"lint",
|
||||||
|
]
|
||||||
|
exec_timeout_secs: 600 # 10 min timeout for the task overall
|
||||||
|
depends_on:
|
||||||
|
- name: version_expansions_gen
|
||||||
|
variant: generate-tasks-for-version
|
||||||
|
commands:
|
||||||
|
- func: "do bazel setup"
|
||||||
|
- func: "bazel compile"
|
||||||
|
vars:
|
||||||
|
targets: compiledb
|
||||||
|
- func: bazel run
|
||||||
|
vars:
|
||||||
|
target: //evergreen:validate_compile_commands
|
||||||
|
|
||||||
- name: run_bazel_program_windows
|
- name: run_bazel_program_windows
|
||||||
tags: ["assigned_to_jira_team_devprod_build", "auxiliary", "bazel_check"]
|
tags: ["assigned_to_jira_team_devprod_build", "auxiliary", "bazel_check"]
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ buildvariants:
|
||||||
resmoke_jobs_max: 6
|
resmoke_jobs_max: 6
|
||||||
tasks:
|
tasks:
|
||||||
- name: compile_test_serial_TG
|
- name: compile_test_serial_TG
|
||||||
|
- name: run_bazel_compiledb
|
||||||
- name: run_unit_tests_TG
|
- name: run_unit_tests_TG
|
||||||
- name: audit
|
- name: audit
|
||||||
- name: auth_audit_gen
|
- name: auth_audit_gen
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ buildvariants:
|
||||||
- name: compile_test_serial_no_unittests_TG
|
- name: compile_test_serial_no_unittests_TG
|
||||||
distros:
|
distros:
|
||||||
- windows-2022-xxxlarge-compile
|
- windows-2022-xxxlarge-compile
|
||||||
|
- name: run_bazel_compiledb
|
||||||
- name: run_unit_tests_no_sandbox_TG
|
- name: run_unit_tests_no_sandbox_TG
|
||||||
distros:
|
distros:
|
||||||
- windows-2022-xxxlarge-compile
|
- windows-2022-xxxlarge-compile
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
py_binary(
|
||||||
|
name = "validate_compile_commands",
|
||||||
|
srcs = ["validate_compile_commands.py"],
|
||||||
|
main = "validate_compile_commands.py",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
@ -6,3 +6,6 @@ filters:
|
||||||
- "retry_git.sh":
|
- "retry_git.sh":
|
||||||
approvers:
|
approvers:
|
||||||
- 10gen/devprod-correctness
|
- 10gen/devprod-correctness
|
||||||
|
- "validate_compile_commands.py":
|
||||||
|
approvers:
|
||||||
|
- 10gen/devprod-build
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
default_dir = os.environ.get("BUILD_WORKSPACE_DIRECTORY")
|
||||||
|
if not default_dir:
|
||||||
|
print(
|
||||||
|
"This script must be run though bazel. Please run 'bazel run //evergreen:validate_compile_commands' instead."
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
os.chdir(default_dir)
|
||||||
|
|
||||||
|
if not os.path.exists("compile_commands.json"):
|
||||||
|
sys.stderr.write("The 'compile_commands.json' file was not found.\n")
|
||||||
|
sys.stderr.write("Attempting to run 'bazel build compiledb' to generate it.\n")
|
||||||
|
subprocess.run(["bazel", "build", "compiledb"], check=True)
|
||||||
|
|
||||||
|
with open("compile_commands.json") as f:
|
||||||
|
compiledb = json.load(f)
|
||||||
|
# super basic check for now
|
||||||
|
if len(compiledb) < 1000:
|
||||||
|
sys.stderr.write(
|
||||||
|
f"ERROR: 'compile_commands.json' has less than 1000 entries. Found {len(compiledb)} entries.\n"
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
print("Successfully validated compile_commands.json file.")
|
||||||
Loading…
Reference in New Issue