2018-11-11 08:19:04 -08:00
|
|
|
#!/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/_
|
2019-02-21 22:38:36 -08:00
|
|
|
|
|
|
|
annotate() {
|
|
|
|
${BUILDKITE:-false} && {
|
|
|
|
buildkite-agent annotate "$@"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-18 13:12:44 -08:00
|
|
|
ci/version-check-with-upgrade.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"
|
2019-02-02 10:42:08 -08:00
|
|
|
source scripts/ulimit-n.sh
|
2019-02-21 22:38:36 -08:00
|
|
|
|
|
|
|
# Clear cached json keypair files
|
|
|
|
rm -rf "$HOME/.config/solana"
|
|
|
|
|
|
|
|
# Run tbe appropriate test based on entrypoint
|
|
|
|
testName=$(basename "$0" .sh)
|
|
|
|
case $testName in
|
|
|
|
test-stable)
|
|
|
|
echo "Executing $testName"
|
|
|
|
|
|
|
|
_ cargo build --all ${V:+--verbose}
|
|
|
|
_ cargo test --all ${V:+--verbose} -- --nocapture --test-threads=1
|
2019-03-05 07:40:26 -08:00
|
|
|
_ cargo test --manifest-path programs/system/Cargo.toml
|
2019-02-21 22:38:36 -08:00
|
|
|
;;
|
|
|
|
test-stable-perf)
|
|
|
|
echo "Executing $testName"
|
|
|
|
|
|
|
|
ci/affects-files.sh \
|
2019-02-27 08:18:29 -08:00
|
|
|
.rs$ \
|
|
|
|
Cargo.lock$ \
|
|
|
|
Cargo.toml$ \
|
|
|
|
ci/test-stable-perf.sh \
|
|
|
|
ci/test-stable.sh \
|
|
|
|
^programs/ \
|
|
|
|
^sdk/ \
|
|
|
|
|| {
|
|
|
|
annotate --style info \
|
|
|
|
"Skipped test-stable-perf as no relavant files were modified"
|
|
|
|
exit 0
|
|
|
|
}
|
2019-02-21 22:38:36 -08:00
|
|
|
|
2019-03-04 10:08:21 -08:00
|
|
|
# BPF program tests
|
2019-02-27 08:18:29 -08:00
|
|
|
_ make -C programs/bpf/c tests
|
2019-03-04 10:08:21 -08:00
|
|
|
_ programs/bpf/rust/noop/build.sh # Must be built out of band
|
|
|
|
_ cargo test --manifest-path programs/bpf/Cargo.toml --no-default-features --features=bpf_c,bpf_rust
|
2019-02-27 08:18:29 -08:00
|
|
|
|
2019-03-04 10:08:21 -08:00
|
|
|
# Run root package tests with these features
|
2019-02-27 08:18:29 -08:00
|
|
|
ROOT_FEATURES=erasure,chacha
|
|
|
|
if [[ $(uname) = Darwin ]]; then
|
|
|
|
./build-perf-libs.sh
|
|
|
|
else
|
|
|
|
# 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
|
|
|
|
|
|
|
|
./fetch-perf-libs.sh
|
|
|
|
# shellcheck source=/dev/null
|
|
|
|
source ./target/perf-libs/env.sh
|
|
|
|
ROOT_FEATURES=$ROOT_FEATURES,cuda
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Run root package library tests
|
|
|
|
_ cargo build --all ${V:+--verbose} --features="$ROOT_FEATURES"
|
|
|
|
_ cargo test --all --lib ${V:+--verbose} --features="$ROOT_FEATURES" -- --nocapture --test-threads=1
|
2019-03-05 07:40:26 -08:00
|
|
|
_ cargo test --manifest-path programs/system/Cargo.toml
|
2019-02-27 08:18:29 -08:00
|
|
|
|
|
|
|
# Run root package integration tests
|
|
|
|
for test in tests/*.rs; do
|
|
|
|
test=${test##*/} # basename x
|
|
|
|
test=${test%.rs} # basename x .rs
|
|
|
|
(
|
|
|
|
export RUST_LOG="$test"=trace,$RUST_LOG
|
|
|
|
_ cargo test --all ${V:+--verbose} --features="$ROOT_FEATURES" --test="$test" \
|
|
|
|
-- --test-threads=1 --nocapture
|
|
|
|
)
|
|
|
|
done
|
2019-02-21 22:38:36 -08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Error: Unknown test: $testName"
|
|
|
|
;;
|
|
|
|
esac
|
2018-10-30 22:53:36 -07:00
|
|
|
|
2019-02-21 22:38:36 -08:00
|
|
|
# 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
|
2019-01-13 09:18:50 -08:00
|
|
|
USE_INSTALL=1 ci/localnet-sanity.sh -x
|
2018-07-30 12:51:35 -07:00
|
|
|
)
|