From 49551b07bfa09fcc801e6c69c136ee03ea89c191 Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Mon, 2 May 2022 09:03:36 +0000 Subject: [PATCH] build: race-test only `pkg/server` on master/bors Having a highly variable race build on the merge path is not useful, especially since these tests may time out when too many of them are selected. Instead, run only a canary package under `stressrace` while merging and on master. The PR build continues its old behavior of racing changed packages. The nightly builds continue to run `stressrace` on the entire unit test suite. See [internal discussion]. [internal discussion]: https://cockroachlabs.slack.com/archives/C023S0V4YEB/p1651171505172649 Release note: None --- build/teamcity-support.sh | 3 +++ build/teamcity-testrace.sh | 6 +++--- build/teamcity/cockroach/ci/tests/testrace.sh | 13 +++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/build/teamcity-support.sh b/build/teamcity-support.sh index 70b0afa0317a..6f62897fb1da 100755 --- a/build/teamcity-support.sh +++ b/build/teamcity-support.sh @@ -286,6 +286,9 @@ tc_release_branch() { [[ "$TC_BUILD_BRANCH" == master || "$TC_BUILD_BRANCH" == release-* || "$TC_BUILD_BRANCH" == provisional_* ]] } +tc_bors_branch() { + [[ "$TC_BUILD_BRANCH" == staging ]] +} if_tc() { if [[ "${TC_BUILD_ID-}" ]]; then diff --git a/build/teamcity-testrace.sh b/build/teamcity-testrace.sh index cae8220d526a..42f3095411c8 100755 --- a/build/teamcity-testrace.sh +++ b/build/teamcity-testrace.sh @@ -10,9 +10,9 @@ export TMPDIR=$PWD/artifacts/testrace mkdir -p "$TMPDIR" tc_start_block "Determine changed packages" -if tc_release_branch; then - pkgspec=./pkg/... - echo "On release branch ($TC_BUILD_BRANCH), so running testrace on all packages ($pkgspec)" +if tc_release_branch || tc_bors_branch; then + pkgspec=./pkg/server + echo "On release or bors branch ($TC_BUILD_BRANCH), so running testrace canary only ($pkgspec)" else pkgspec=$(changed_go_pkgs) if [[ $(echo "$pkgspec" | wc -w) -gt 10 ]]; then diff --git a/build/teamcity/cockroach/ci/tests/testrace.sh b/build/teamcity/cockroach/ci/tests/testrace.sh index 5e3ec7c98ee2..9c78bd8ea8a4 100755 --- a/build/teamcity/cockroach/ci/tests/testrace.sh +++ b/build/teamcity/cockroach/ci/tests/testrace.sh @@ -7,10 +7,19 @@ dir="$(dirname $(dirname $(dirname $(dirname $(dirname "${0}")))))" source "$dir/teamcity-support.sh" # For $root, changed_go_pkgs source "$dir/teamcity-bazel-support.sh" # For run_bazel +# The full race suite takes >4h and is only suitable for nightlies. On master +# and staging, run just the `server` package which (at the time of writing) +# takes <30m to run and exercises most of the code in the system at least +# rudimentarily. This (hopefully) causes obvious races to fail in bors, +# before spraying failures over the nightly stress suite. +canaryspec=./pkg/server tc_start_block "Determine changed packages" if tc_release_branch; then - pkgspec=./pkg/... - echo "On release branch ($TC_BUILD_BRANCH), so running testrace on all packages ($pkgspec)" + pkgspec="${canaryspec}" + echo "On release branch ($TC_BUILD_BRANCH), so running canary testrace ($pkgspec)" +elif tc_bors_branch; then + pkgspec="${canaryspec}" + echo "On bors branch ($TC_BUILD_BRANCH), so running canary testrace ($pkgspec)" else pkgspec=$(changed_go_pkgs) if [[ $(echo "$pkgspec" | wc -w) -gt 10 ]]; then