Fix sanity test flakiness by prebuilding binaries (#16530) (#16547)

* Fix sanity test flakiness by prebuilding binaries

* ignore shellcheck

* bump

* nudge

* simplify

(cherry picked from commit 328e7690f3)

Co-authored-by: Justin Starry <justin@solana.com>
This commit is contained in:
mergify[bot]
2021-04-14 18:52:15 +00:00
committed by GitHub
parent 4ef3a679a4
commit 28683b0ad8
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