Squashed 'third_party/bazel-toolchain/' content from commit a912bb381
Change-Id: Ie1ff8ed3b3948cca1d1b6227097c95e5a048de86
git-subtree-dir: third_party/bazel-toolchain
git-subtree-split: a912bb381b36437be0eeb22de11f0ea198450b4e
Signed-off-by: Brian Silverman <bsilver16834@gmail.com>
diff --git a/tests/scripts/bazel.sh b/tests/scripts/bazel.sh
new file mode 100644
index 0000000..87d7cf1
--- /dev/null
+++ b/tests/scripts/bazel.sh
@@ -0,0 +1,30 @@
+os="$(uname -s | tr "[:upper:]" "[:lower:]")"
+readonly os
+
+arch="$(uname -m)"
+if [[ "${arch}" == "x86_64" ]]; then
+ arch="amd64"
+elif [[ "${arch}" == "aarch64" ]]; then
+ arch="arm64"
+else
+ >&2 echo "Unknown architecture: ${arch}"
+fi
+readonly arch
+
+# Use bazelisk to catch migration problems.
+readonly bazelisk_version="v1.10.1"
+readonly url="https://github.com/bazelbuild/bazelisk/releases/download/${bazelisk_version}/bazelisk-${os}-${arch}"
+bazel="${TMPDIR:-/tmp}/bazelisk"
+readonly bazel
+
+readonly common_test_args=(
+ --incompatible_enable_cc_toolchain_resolution
+ --symlink_prefix=/
+ --color=yes
+ --show_progress_rate_limit=30
+ --keep_going
+ --test_output=errors
+)
+
+curl -L -sSf -o "${bazel}" "${url}"
+chmod a+x "${bazel}"