-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't add test jobs if test results are up-of-date in the cache.
Bazel lacks a method to verify if test results are current in the cache. Additional details can be found at: bazelbuild/bazel#3978. To address this limitation, let's change the test runner so that it doesn't run tests and exits with a non-zero code immediately if the $TEST_CHECK_UP_TO_DATE_FILE file exists. To check test results in the cache, we need to create the $TEST_CHECK_UP_TO_DATE_FILE and run tests. Successful test execution indicates that the results are up-to-date in the cache. Signed-off-by: Andrei Vagin <avagin@google.com>
- Loading branch information
Showing
5 changed files
with
91 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2024 The gVisor Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Add runtime test jobs only if test results in the case are outdated. | ||
|
||
set -xeo pipefail | ||
|
||
exec 1>&2 | ||
|
||
cmd="$1" | ||
shift | ||
export TOTAL_PARTITIONS="$1" | ||
shift | ||
|
||
if [[ -z "$TEST_CHECK_UP_TO_DATE_FILE" ]]; then | ||
echo "TEST_CHECK_UP_TO_DATE_FILE isn't set" | ||
exit 1 | ||
fi | ||
|
||
function cleanup() { | ||
if [[ -f "$TEST_CHECK_UP_TO_DATE_FILE" ]]; then | ||
rm -rf $TEST_CHECK_UP_TO_DATE_FILE | ||
fi | ||
} | ||
|
||
touch $TEST_CHECK_UP_TO_DATE_FILE | ||
trap cleanup EXIT | ||
|
||
for PARTITION in `seq "$TOTAL_PARTITIONS"`; do | ||
export PARTITION | ||
if make $cmd-runtime-tests; then | ||
continue | ||
fi | ||
( cat <<EOF | ||
- label: "${BUILDKITE_LABEL} ($PARTITION/$TOTAL_PARTITIONS)" | ||
timeout_in_minutes: 30 | ||
retry: | ||
automatic: | ||
- exit_status: -1 | ||
limit: 10 | ||
- exit_status: "*" | ||
limit: 2 | ||
command: make $cmd-runtime-tests RUNTIME_ARGS="$@" | ||
agents: | ||
arch: "amd64" | ||
env: | ||
BUILDKITE_PIPELINE_INSTALL_RUNTIME: true | ||
TOTAL_PARTITIONS: $TOTAL_PARTITIONS | ||
PARTITION: $PARTITION | ||
EOF | ||
) | tee /proc/self/fd/2 | buildkite-agent pipeline upload | ||
done |