Skip to content

Commit

Permalink
build: support running extra checks on ARM
Browse files Browse the repository at this point in the history
This code change changes CI scripts for acceptance, bench,
and roachtest to be runnable on ARM machines.

Release note: None
  • Loading branch information
healthy-pod committed Oct 12, 2022
1 parent 660f6d1 commit be6ca30
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
11 changes: 9 additions & 2 deletions build/teamcity/cockroach/ci/tests/acceptance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ dir="$(dirname $(dirname $(dirname $(dirname $(dirname "${0}")))))"
source "$dir/teamcity-support.sh"
source "$dir/teamcity-bazel-support.sh" # For run_bazel

if [[ "$(uname -m)" =~ (arm64|aarch64)$ ]]; then
export CROSSLINUX_CONFIG="crosslinuxarm"
else
export CROSSLINUX_CONFIG="crosslinux"
fi

tc_start_block "Build cockroach"
run_bazel /usr/bin/bash -c 'bazel build --config crosslinux --config ci //pkg/cmd/cockroach-short && cp $(bazel info bazel-bin --config crosslinux --config ci)/pkg/cmd/cockroach-short/cockroach-short_/cockroach-short /artifacts/cockroach && chmod a+w /artifacts/cockroach'
build_script='bazel build --config $1 --config ci //pkg/cmd/cockroach-short && cp $(bazel info bazel-bin --config $1 --config ci)/pkg/cmd/cockroach-short/cockroach-short_/cockroach-short /artifacts/cockroach && chmod a+w /artifacts/cockroach'
run_bazel /usr/bin/bash -c "$build_script" -- "$CROSSLINUX_CONFIG"
tc_end_block "Build cockroach"

export ARTIFACTSDIR=$PWD/artifacts/acceptance
Expand All @@ -21,7 +28,7 @@ BAZCI=$(bazel info bazel-bin --config=ci)/pkg/cmd/bazci/bazci_/bazci

$BAZCI --artifacts_dir=$PWD/artifacts -- \
test //pkg/acceptance:acceptance_test \
--config=crosslinux --config=ci \
--config=$CROSSLINUX_CONFIG --config=ci \
"--sandbox_writable_path=$ARTIFACTSDIR" \
"--test_tmpdir=$ARTIFACTSDIR" \
--test_arg=-l="$ARTIFACTSDIR" \
Expand Down
8 changes: 7 additions & 1 deletion build/teamcity/cockroach/ci/tests/bench_impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ set -euo pipefail
dir="$(dirname $(dirname $(dirname $(dirname $(dirname "${0}")))))"
source "$dir/teamcity/util.sh"

if [[ "$(uname -m)" =~ (arm64|aarch64)$ ]]; then
export CROSSLINUX_CONFIG="crosslinuxarm"
else
export CROSSLINUX_CONFIG="crosslinux"
fi

# Enumerate test targets that have benchmarks.
all_tests=$(bazel query 'kind(go_test, //pkg/...)' --output=label)
pkgs=$(git grep -l '^func Benchmark' -- 'pkg/*_test.go' | rev | cut -d/ -f2- | rev | sort | uniq)
Expand All @@ -21,7 +27,7 @@ do
tc_start_block "Bench $target"
# We need the `test_sharding_strategy` flag or else the benchmarks will
# fail to run sharded tests like //pkg/sql/importer:importer_test.
bazel run --config=test --config=crosslinux --config=ci --test_sharding_strategy=disabled $target -- \
bazel run --config=test --config=$CROSSLINUX_CONFIG --config=ci --test_sharding_strategy=disabled $target -- \
-test.bench=. -test.benchtime=1ns -test.short -test.run=-
tc_end_block "Bench $target"
done
10 changes: 8 additions & 2 deletions build/teamcity/cockroach/ci/tests/local_roachtest_impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

set -euo pipefail

bazel build --config=crosslinux --config=ci //pkg/cmd/cockroach-short \
if [[ "$(uname -m)" =~ (arm64|aarch64)$ ]]; then
export CROSSLINUX_CONFIG="crosslinuxarm"
else
export CROSSLINUX_CONFIG="crosslinux"
fi

bazel build --config=$CROSSLINUX_CONFIG --config=ci //pkg/cmd/cockroach-short \
//pkg/cmd/roachtest \
//pkg/cmd/workload

BAZEL_BIN=$(bazel info bazel-bin --config=crosslinux --config=ci)
BAZEL_BIN=$(bazel info bazel-bin --config=$CROSSLINUX_CONFIG --config=ci)
$BAZEL_BIN/pkg/cmd/roachtest/roachtest_/roachtest run acceptance kv/splits cdc/bank \
--local \
--parallelism=1 \
Expand Down

0 comments on commit be6ca30

Please sign in to comment.