SERVER-117858: Use --run_under to wrap CI test targets (#47015)
GitOrigin-RevId: 51eea2cf128fc40de3cbed28f7bb07b7cc12713b
This commit is contained in:
parent
c11eae1f39
commit
7dc29a8dbc
@ -664,7 +664,7 @@ def _mongo_cc_binary_and_test(
|
||||
"visibility": visibility,
|
||||
"testonly": testonly,
|
||||
"copts": copts,
|
||||
"data": data + SANITIZER_DATA,
|
||||
"data": data + SANITIZER_DATA + ["//bazel:test_wrapper"],
|
||||
"tags": tags,
|
||||
"linkopts": linkopts + rpath_flags + select({
|
||||
"//bazel/config:thin_lto_enabled": ["-Wl,--threads=" + str(NUM_CPUS)],
|
||||
@ -742,22 +742,6 @@ def _mongo_cc_binary_and_test(
|
||||
exec_properties = exec_properties,
|
||||
)
|
||||
|
||||
native.sh_test(
|
||||
name = name + "_ci_wrapper",
|
||||
srcs = [
|
||||
"//bazel:test_wrapper",
|
||||
],
|
||||
tags = original_tags + ["wrapper_target"],
|
||||
args = [
|
||||
"$(location " + name + ")",
|
||||
],
|
||||
data = args["data"] + [name],
|
||||
env = args["env"],
|
||||
target_compatible_with = target_compatible_with,
|
||||
visibility = visibility,
|
||||
exec_properties = exec_properties,
|
||||
)
|
||||
|
||||
def mongo_cc_binary(
|
||||
name,
|
||||
srcs = [],
|
||||
|
||||
@ -11,12 +11,12 @@ mongo_cc_binary(
|
||||
|
||||
# Test for verifying test_wrapper.sh timeout behavior and coredump generation.
|
||||
# This test intentionally hangs to trigger the timeout mechanism in test_wrapper.sh.
|
||||
# When run via the _ci_wrapper target, it should:
|
||||
# When run via the --run_under=//bazel:test_wrapper param, it should:
|
||||
# 1. Get killed by SIGABRT after the configured timeout
|
||||
# 2. Generate a coredump file saved to TEST_UNDECLARED_OUTPUTS_DIR
|
||||
#
|
||||
# Usage:
|
||||
# bazel test --config=remote_test //buildscripts/bazel_testbuilds:ci_wrapper_timeout_test_ci_wrapper
|
||||
# bazel test --config=remote_test //buildscripts/bazel_testbuilds:ci_wrapper_timeout_test --run_under=//bazel:test_wrapper
|
||||
mongo_cc_unit_test(
|
||||
name = "ci_wrapper_timeout_test",
|
||||
srcs = ["ci_wrapper_timeout_test.cpp"],
|
||||
|
||||
@ -6,13 +6,13 @@
|
||||
* 1. Trigger the SIGABRT signal from test_wrapper.sh
|
||||
* 2. Generate a coredump file
|
||||
*
|
||||
* When run via the _ci_wrapper target, this test should:
|
||||
* When run via the --run_under=//bazel:test_wrapper param, this test should:
|
||||
* - Get killed by SIGABRT after 10 minutes (or 40 on ppc64le/s390x)
|
||||
* - Produce a coredump file that gets saved to TEST_UNDECLARED_OUTPUTS_DIR
|
||||
*
|
||||
* Usage:
|
||||
* bazel test --config=remote_test
|
||||
* //buildscripts/bazel_testbuilds:ci_wrapper_timeout_test_ci_wrapper
|
||||
* //buildscripts/bazel_testbuilds:ci_wrapper_timeout_test --run_under=//bazel:test_wrapper
|
||||
*/
|
||||
|
||||
#include "mongo/unittest/assert.h"
|
||||
|
||||
@ -21,8 +21,8 @@ REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
||||
# Change to repo root for bazel commands
|
||||
cd "$REPO_ROOT" || exit 1
|
||||
|
||||
TEST_TARGET="//buildscripts/bazel_testbuilds:ci_wrapper_timeout_test_ci_wrapper"
|
||||
TESTLOGS_PATH="bazel-testlogs/buildscripts/bazel_testbuilds/ci_wrapper_timeout_test_ci_wrapper"
|
||||
TEST_TARGET="//buildscripts/bazel_testbuilds:ci_wrapper_timeout_test"
|
||||
TESTLOGS_PATH="bazel-testlogs/buildscripts/bazel_testbuilds/ci_wrapper_timeout_test"
|
||||
|
||||
# Cleanup function to restore modified files and remove temp directories
|
||||
TEMP_DIR=""
|
||||
@ -60,7 +60,7 @@ echo ""
|
||||
# The test is expected to fail (non-zero exit code) because it gets killed by SIGABRT
|
||||
# We still want to continue and check for coredump
|
||||
# Use --curses=no and --color=no to prevent interactive output that might cause hangs in CI
|
||||
bazel test --config=remote_test --curses=no --color=no "${TEST_TARGET}" 2>&1 && BAZEL_EXIT_CODE=0 || BAZEL_EXIT_CODE=$?
|
||||
bazel test --config=remote_test --run_under=//bazel:test_wrapper --curses=no --color=no "${TEST_TARGET}" 2>&1 && BAZEL_EXIT_CODE=0 || BAZEL_EXIT_CODE=$?
|
||||
|
||||
echo ""
|
||||
echo "Bazel test exit code: ${BAZEL_EXIT_CODE}"
|
||||
@ -191,7 +191,7 @@ fi
|
||||
|
||||
# Verify the coredump was generated by the actual test binary, not by /bin/bash
|
||||
# Good: Core was generated by `.../ci_wrapper_timeout_test'
|
||||
# Bad: Core was generated by `/bin/bash .../ci_wrapper_timeout_test_ci_wrapper'
|
||||
# Bad: Core was generated by `/bin/bash .../ci_wrapper_timeout_test'
|
||||
|
||||
if echo "${CORE_GENERATED_LINE}" | grep -q "/bin/bash"; then
|
||||
echo "FAILED: Coredump was generated by /bin/bash (the wrapper script)."
|
||||
|
||||
@ -42,7 +42,7 @@ def main(testlog_dir: str):
|
||||
testcase = testsuite.find("testcase")
|
||||
|
||||
# Replace part of the name added by the remote test wrapper script
|
||||
test_file = testcase.attrib["name"].replace("_ci_wrapper", "")
|
||||
test_file = testcase.attrib["name"]
|
||||
|
||||
if testcase.find("error") is not None:
|
||||
status = "fail"
|
||||
|
||||
@ -62,7 +62,7 @@ def _copy_bins_to_upload(upload_bin_dir: str, upload_lib_dir: str):
|
||||
dsyms.append(Path(dirpath))
|
||||
for f in filenames:
|
||||
file = Path(f)
|
||||
if file.stem.endswith(("_with_debug", "_ci_wrapper")):
|
||||
if file.stem.endswith("_with_debug"):
|
||||
continue
|
||||
if file.suffix in [".so", ".so.debug", ".dylib"]:
|
||||
libs.append(Path(os.path.join(dirpath, file)))
|
||||
|
||||
@ -14,7 +14,7 @@ Below is information about the smoke test suites available for each team and how
|
||||
Tests are tagged with `catalog-and-routing`. To run:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,catalog-and-routing //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,catalog-and-routing //...
|
||||
```
|
||||
|
||||
## Server Integration
|
||||
@ -22,7 +22,7 @@ bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediat
|
||||
Tests are tagged with `server-integration-smoke`. To run:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-integration-smoke //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-integration-smoke //...
|
||||
```
|
||||
|
||||
## Replication
|
||||
@ -36,13 +36,13 @@ bazel test --test_tag_filters=replication-smoke //...
|
||||
This should be run in conjunction with the unit tests, which can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug //src/mongo/db/repl/...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug //src/mongo/db/repl/...
|
||||
```
|
||||
|
||||
To run both combined:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=mongo_unittest,replication-smoke,-wrapper_target,-intermediate_debug //src/mongo/db/repl/... //buildscripts/smoke_tests/...
|
||||
bazel test --test_output=summary --test_tag_filters=mongo_unittest,replication-smoke,-intermediate_debug //src/mongo/db/repl/... //buildscripts/smoke_tests/...
|
||||
```
|
||||
|
||||
## Server Programmability
|
||||
@ -50,7 +50,7 @@ bazel test --test_output=summary --test_tag_filters=mongo_unittest,replication-s
|
||||
Tests are tagged with `server-programmability`. To run:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-programmability //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-programmability //...
|
||||
```
|
||||
|
||||
## Storage Execution
|
||||
@ -59,7 +59,7 @@ The smoke test suites for storage execution are divided up into components. The
|
||||
for all of the components that storage execution owns can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-bsoncolumn,server-collection-write-path,server-external-sorter,server-index-builds,server-key-string,server-storage-engine-integration,server-timeseries-bucket-catalog,server-tracking-allocators,server-ttl //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-bsoncolumn,server-collection-write-path,server-external-sorter,server-index-builds,server-key-string,server-storage-engine-integration,server-timeseries-bucket-catalog,server-tracking-allocators,server-ttl //...
|
||||
```
|
||||
|
||||
The individual components owned by storage execution are as follows:
|
||||
@ -69,7 +69,7 @@ The individual components owned by storage execution are as follows:
|
||||
The unit tests for the server-bsoncolumn component can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-bsoncolumn //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-bsoncolumn //...
|
||||
```
|
||||
|
||||
There are currently no smoke test integration tests for this component.
|
||||
@ -79,7 +79,7 @@ There are currently no smoke test integration tests for this component.
|
||||
The unit and integration tests for the server-collection-write-path component can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-collection-write-path //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-collection-write-path //...
|
||||
```
|
||||
|
||||
### Server-External-Sorter
|
||||
@ -87,7 +87,7 @@ bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediat
|
||||
The unit tests for the server-external-sorter component can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-external-sorter //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-external-sorter //...
|
||||
```
|
||||
|
||||
There are currently no smoke test integration tests for this component.
|
||||
@ -97,7 +97,7 @@ There are currently no smoke test integration tests for this component.
|
||||
The unit and integration tests for the server-index-builds component can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-index-builds //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-index-builds //...
|
||||
```
|
||||
|
||||
### Server-Key-String
|
||||
@ -105,7 +105,7 @@ bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediat
|
||||
The unit tests for the server-key-string component can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-key-string //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-key-string //...
|
||||
```
|
||||
|
||||
There are currently no smoke test integration tests for this component.
|
||||
@ -115,7 +115,7 @@ There are currently no smoke test integration tests for this component.
|
||||
The unit and integration tests for the server-storage-engine-integration component can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-storage-engine-integration //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-storage-engine-integration //...
|
||||
```
|
||||
|
||||
### Server-Timeseries-Bucket-Catalog
|
||||
@ -123,7 +123,7 @@ bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediat
|
||||
The unit tests for the server-timeseries-bucket-catalog component can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-timeseries-bucket-catalog //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-timeseries-bucket-catalog //...
|
||||
```
|
||||
|
||||
There are currently no smoke test integration tests for this component.
|
||||
@ -133,7 +133,7 @@ There are currently no smoke test integration tests for this component.
|
||||
The unit tests for the server-tracking-allocators component can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-tracking-allocators //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-tracking-allocators //...
|
||||
```
|
||||
|
||||
There are currently no smoke test integration tests for this component.
|
||||
@ -143,5 +143,5 @@ There are currently no smoke test integration tests for this component.
|
||||
The unit and integration tests for the server-ttl component can be run with the following:
|
||||
|
||||
```
|
||||
bazel test --test_output=summary --test_tag_filters=-wrapper_target,-intermediate_debug,server-ttl //...
|
||||
bazel test --test_output=summary --test_tag_filters=-intermediate_debug,server-ttl //...
|
||||
```
|
||||
|
||||
@ -397,7 +397,7 @@ def run_smoke_tests(
|
||||
BAZEL,
|
||||
"test",
|
||||
*bazel_args,
|
||||
f"--test_tag_filters={test_tag},-wrapper_target,-intermediate_debug",
|
||||
f"--test_tag_filters={test_tag},-intermediate_debug",
|
||||
"--test_output=summary",
|
||||
"--dev_stacktrace=False",
|
||||
*test_build_target,
|
||||
|
||||
@ -80,7 +80,6 @@ FOUND=()
|
||||
for label in "${RAW_LABELS[@]}"; do
|
||||
[[ -z "$label" ]] && continue
|
||||
[[ "$label" == *"_with_debug"* ]] && continue
|
||||
[[ "$label" == *"_ci_wrapper"* ]] && continue
|
||||
[[ "$label" == *"third_party"* ]] && continue
|
||||
[[ "$label" != //* ]] && continue
|
||||
|
||||
|
||||
@ -929,7 +929,7 @@ tasks:
|
||||
target: >-
|
||||
//src/mongo/...
|
||||
args: >-
|
||||
--test_tag_filters=mongo_unittest_debug,-final_target,-code_coverage_quarantine_debug
|
||||
--test_tag_filters=mongo_unittest_debug,-code_coverage_quarantine_debug
|
||||
--test_timeout=1800
|
||||
--verbose_failures
|
||||
--instrumentation_filter=^//src/mongo[/:],-^//src/mongo/util:boost_assert_shim,-^//src/mongo/util:icu,-^//src/mongo/db/modules/enterprise/src/streams/third_party[/:]
|
||||
@ -1174,12 +1174,13 @@ tasks:
|
||||
--config=evg
|
||||
--linkstatic=False
|
||||
--separate_debug=False
|
||||
--test_tag_filters=mongo_unittest,-final_target,-intermediate_debug,-incompatible_with_bazel_remote_test
|
||||
--test_tag_filters=mongo_unittest,-intermediate_debug,-incompatible_with_bazel_remote_test
|
||||
--build_tag_filters=mongo_unittest,-incompatible_with_bazel_remote_test
|
||||
--keep_going
|
||||
--test_arg=--showEachTest
|
||||
--define GIT_COMMIT_HASH=nogitversion
|
||||
--define=MONGO_VERSION=8.3.0-alpha-patch-nogitversion
|
||||
--run_under=//bazel:test_wrapper
|
||||
|
||||
- name: unit_tests_remote_exec_incompatible
|
||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||
@ -1205,12 +1206,13 @@ tasks:
|
||||
--config=evg
|
||||
--include_autogenerated_targets=True
|
||||
--separate_debug=False
|
||||
--test_tag_filters=incompatible_with_bazel_remote_test,-intermediate_debug,-final_target
|
||||
--test_tag_filters=incompatible_with_bazel_remote_test,-intermediate_debug
|
||||
--build_tag_filters=incompatible_with_bazel_remote_test
|
||||
--keep_going
|
||||
--test_arg=--showEachTest
|
||||
--define GIT_COMMIT_HASH=nogitversion
|
||||
--define=MONGO_VERSION=8.3.0-alpha-patch-nogitversion
|
||||
--run_under=//bazel:test_wrapper
|
||||
|
||||
- name: unit_test_group1
|
||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||
@ -1236,10 +1238,11 @@ tasks:
|
||||
--config=evg
|
||||
--include_autogenerated_targets=True
|
||||
--separate_debug=False
|
||||
--test_tag_filters=mongo_unittest_first_group,-intermediate_debug,-final_target
|
||||
--test_tag_filters=mongo_unittest_first_group,-intermediate_debug
|
||||
--build_tag_filters=mongo_unittest_first_group
|
||||
--keep_going
|
||||
--test_arg=--showEachTest
|
||||
--run_under=//bazel:test_wrapper
|
||||
|
||||
- name: unit_test_group2
|
||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||
@ -1265,10 +1268,11 @@ tasks:
|
||||
--config=evg
|
||||
--include_autogenerated_targets=True
|
||||
--separate_debug=False
|
||||
--test_tag_filters=mongo_unittest_second_group,-intermediate_debug,-tracing_test,-final_target
|
||||
--test_tag_filters=mongo_unittest_second_group,-intermediate_debug,-tracing_test
|
||||
--build_tag_filters=mongo_unittest_second_group
|
||||
--keep_going
|
||||
--test_arg=--showEachTest
|
||||
--run_under=//bazel:test_wrapper
|
||||
|
||||
- name: unit_test_group3
|
||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||
@ -1294,10 +1298,11 @@ tasks:
|
||||
--config=evg
|
||||
--include_autogenerated_targets=True
|
||||
--separate_debug=False
|
||||
--test_tag_filters=mongo_unittest_third_group,-intermediate_debug,-final_target
|
||||
--test_tag_filters=mongo_unittest_third_group,-intermediate_debug
|
||||
--build_tag_filters=mongo_unittest_third_group
|
||||
--keep_going
|
||||
--test_arg=--showEachTest
|
||||
--run_under=//bazel:test_wrapper
|
||||
|
||||
- name: unit_test_group4
|
||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||
@ -1323,10 +1328,11 @@ tasks:
|
||||
--config=evg
|
||||
--include_autogenerated_targets=True
|
||||
--separate_debug=False
|
||||
--test_tag_filters=mongo_unittest_fourth_group,-intermediate_debug,-final_target
|
||||
--test_tag_filters=mongo_unittest_fourth_group,-intermediate_debug
|
||||
--build_tag_filters=mongo_unittest_fourth_group
|
||||
--keep_going
|
||||
--test_arg=--showEachTest
|
||||
--run_under=//bazel:test_wrapper
|
||||
|
||||
- name: unit_test_group5
|
||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||
@ -1352,10 +1358,11 @@ tasks:
|
||||
--config=evg
|
||||
--include_autogenerated_targets=True
|
||||
--separate_debug=False
|
||||
--test_tag_filters=mongo_unittest_fifth_group,-intermediate_debug,-final_target
|
||||
--test_tag_filters=mongo_unittest_fifth_group,-intermediate_debug
|
||||
--build_tag_filters=mongo_unittest_fifth_group
|
||||
--keep_going
|
||||
--test_arg=--showEachTest
|
||||
--run_under=//bazel:test_wrapper
|
||||
|
||||
- name: unit_test_group6
|
||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||
@ -1381,10 +1388,11 @@ tasks:
|
||||
--config=evg
|
||||
--include_autogenerated_targets=True
|
||||
--separate_debug=False
|
||||
--test_tag_filters=mongo_unittest_sixth_group,-intermediate_debug,-final_target
|
||||
--test_tag_filters=mongo_unittest_sixth_group,-intermediate_debug
|
||||
--build_tag_filters=mongo_unittest_sixth_group
|
||||
--keep_going
|
||||
--test_arg=--showEachTest
|
||||
--run_under=//bazel:test_wrapper
|
||||
|
||||
- name: unit_test_group7
|
||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||
@ -1410,10 +1418,11 @@ tasks:
|
||||
--config=evg
|
||||
--include_autogenerated_targets=True
|
||||
--separate_debug=False
|
||||
--test_tag_filters=mongo_unittest_seventh_group,-intermediate_debug,-final_target
|
||||
--test_tag_filters=mongo_unittest_seventh_group,-intermediate_debug
|
||||
--build_tag_filters=mongo_unittest_seventh_group
|
||||
--keep_going
|
||||
--test_arg=--showEachTest
|
||||
--run_under=//bazel:test_wrapper
|
||||
|
||||
- name: unit_test_group8
|
||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||
@ -1439,10 +1448,11 @@ tasks:
|
||||
--config=evg
|
||||
--include_autogenerated_targets=True
|
||||
--separate_debug=False
|
||||
--test_tag_filters=mongo_unittest_eighth_group,-intermediate_debug,-final_target
|
||||
--test_tag_filters=mongo_unittest_eighth_group,-intermediate_debug
|
||||
--build_tag_filters=mongo_unittest_eighth_group
|
||||
--keep_going
|
||||
--test_arg=--showEachTest
|
||||
--run_under=//bazel:test_wrapper
|
||||
|
||||
- name: monitor_build_status
|
||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user