Fix sanity test flakiness by prebuilding binaries (#16530)

* Fix sanity test flakiness by prebuilding binaries

* ignore shellcheck

* bump

* nudge

* simplify
This commit is contained in:
Justin Starry
2021-04-15 01:15:06 +08:00
committed by GitHub
parent f0c150cfb9
commit 328e7690f3
3 changed files with 17 additions and 7 deletions

View File

@ -10,6 +10,11 @@
# shellcheck source=net/common.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. || exit 1; pwd)"/net/common.sh
prebuild=
if [[ $1 = "--prebuild" ]]; then
prebuild=true
fi
if [[ $(uname) != Linux ]]; then
# Protect against unsupported configurations to prevent non-obvious errors
# later. Arguably these should be fatal errors but for now prefer tolerance.
@ -39,14 +44,20 @@ else
program="solana-$program"
fi
if [[ -r "$SOLANA_ROOT/$crate"/Cargo.toml ]]; then
maybe_package="--package solana-$crate"
fi
if [[ -n $NDEBUG ]]; then
maybe_release=--release
fi
declare manifest_path="--manifest-path=$SOLANA_ROOT/$crate/Cargo.toml"
printf "cargo $CARGO_TOOLCHAIN run $manifest_path $maybe_release $maybe_package --bin %s %s -- " "$program"
# Prebuild binaries so that CI sanity check timeout doesn't include build time
if [[ $prebuild ]]; then
(
set -x
# shellcheck disable=SC2086 # Don't want to double quote
cargo $CARGO_TOOLCHAIN build $maybe_release --bin $program
)
fi
printf "cargo $CARGO_TOOLCHAIN run $maybe_release --bin %s %s -- " "$program"
}
fi