solana/ci/test-stable.sh

95 lines
2.5 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
2018-05-27 18:19:07 -07:00
cd "$(dirname "$0")/.."
2018-05-21 23:02:54 -07:00
2018-12-18 14:25:10 -08:00
source ci/_
annotate() {
${BUILDKITE:-false} && {
buildkite-agent annotate "$@"
}
}
source ci/rust-version.sh stable
2018-06-24 21:24:08 -07:00
export RUST_BACKTRACE=1
2018-09-20 18:51:11 -07:00
export RUSTFLAGS="-D warnings"
source scripts/ulimit-n.sh
# Clear cached json keypair files
rm -rf "$HOME/.config/solana"
# Clear the C dependency files, if dependency moves these files are not regenerated
test -d target/debug/bpf && find target/debug/bpf -name '*.d' -delete
test -d target/release/bpf && find target/release/bpf -name '*.d' -delete
2019-06-07 16:44:14 -07:00
# Clear the BPF sysroot files, they are not automatically rebuilt
rm -rf target/xargo # Issue #3105
2019-06-17 11:04:38 -07:00
# Run the appropriate test based on entrypoint
testName=$(basename "$0" .sh)
case $testName in
test-stable)
echo "Executing $testName"
_ cargo +"$rust_stable" build --all --tests --bins ${V:+--verbose}
_ cargo +"$rust_stable" test --all ${V:+--verbose} -- --nocapture
;;
test-stable-perf)
echo "Executing $testName"
ci/affects-files.sh \
2019-02-27 08:18:29 -08:00
.rs$ \
Cargo.lock$ \
Cargo.toml$ \
2019-06-21 12:08:10 -07:00
^ci/test-stable-perf.sh \
^ci/test-stable.sh \
^core/build.rs \
^fetch-perf-libs.sh \
^programs/ \
2019-02-27 08:18:29 -08:00
^sdk/ \
|| {
annotate --style info \
2019-04-24 07:37:26 -07:00
"Skipped test-stable-perf as no relevant files were modified"
2019-02-27 08:18:29 -08:00
exit 0
}
# BPF program tests
_ make -C programs/bpf/c tests
_ cargo +"$rust_stable" test \
--manifest-path programs/bpf/Cargo.toml \
--no-default-features --features=bpf_c,bpf_rust
2019-02-27 08:18:29 -08:00
# Run root package tests with these features
ROOT_FEATURES=
if [[ $(uname) = Linux ]]; then
2019-02-27 08:18:29 -08:00
# Enable persistence mode to keep the CUDA kernel driver loaded, avoiding a
# lengthy and unexpected delay the first time CUDA is involved when the driver
# is not yet loaded.
sudo --non-interactive ./net/scripts/enable-nvidia-persistence-mode.sh
rm -rf target/perf-libs
2019-02-27 08:18:29 -08:00
./fetch-perf-libs.sh
# shellcheck source=/dev/null
source ./target/perf-libs/env.sh
ROOT_FEATURES=cuda
2019-02-27 08:18:29 -08:00
fi
# Run root package library tests
_ cargo +"$rust_stable" build --all --tests --bins ${V:+--verbose} --features="$ROOT_FEATURES"
_ cargo +"$rust_stable" test --manifest-path=core/Cargo.toml ${V:+--verbose} --features="$ROOT_FEATURES" -- --nocapture
;;
*)
echo "Error: Unknown test: $testName"
;;
esac
# Assumes target/debug is populated. Ensure last build command
# leaves target/debug in the state intended for localnet-sanity
2018-07-30 12:51:35 -07:00
echo --- ci/localnet-sanity.sh
(
set -x
export PATH=$PWD/target/debug:$PATH
USE_INSTALL=1 ci/localnet-sanity.sh -x
2018-07-30 12:51:35 -07:00
)