Files
solana/ci/test-stable.sh

92 lines
2.5 KiB
Bash
Raw Permalink 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
cargo="$(readlink -f "./cargo")"
2018-12-18 14:25:10 -08:00
source ci/_
annotate() {
${BUILDKITE:-false} && {
buildkite-agent annotate "$@"
}
}
# Run the appropriate test based on entrypoint
testName=$(basename "$0" .sh)
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
# Limit compiler jobs to reduce memory usage
2020-05-31 22:29:32 -06:00
# on machines with 2gb/thread of memory
NPROC=$(nproc)
2020-05-31 22:29:32 -06:00
NPROC=$((NPROC>14 ? 14 : NPROC))
echo "Executing $testName"
case $testName in
test-stable)
_ "$cargo" stable test --jobs "$NPROC" --all --exclude solana-local-cluster ${V:+--verbose} -- --nocapture
;;
test-stable-perf)
Separate the "program" feature of `solana-sdk` into a new crate called `solana-program` (bp #12989) (#13131) * Add solana-program-sdk boilerplate (cherry picked from commit 3718771ffb9caad0bc1c180e488f699ce895a10e) # Conflicts: # sdk/Cargo.toml * Initial population of solana-program-sdk (cherry picked from commit 63db3242043602c7b9765a066b6f8d01ef20454e) # Conflicts: # Cargo.lock * Port programs to solana-program-sdk (cherry picked from commit fe68f7f786acf13e5b1f1fe4c54eb7af7b549391) # Conflicts: # programs/bpf/Cargo.lock # programs/bpf/rust/128bit/Cargo.toml # programs/bpf/rust/128bit_dep/Cargo.toml # programs/bpf/rust/alloc/Cargo.toml # programs/bpf/rust/call_depth/Cargo.toml # programs/bpf/rust/custom_heap/Cargo.toml # programs/bpf/rust/dep_crate/Cargo.toml # programs/bpf/rust/deprecated_loader/Cargo.toml # programs/bpf/rust/dup_accounts/Cargo.toml # programs/bpf/rust/error_handling/Cargo.toml # programs/bpf/rust/external_spend/Cargo.toml # programs/bpf/rust/instruction_introspection/Cargo.toml # programs/bpf/rust/invoke/Cargo.toml # programs/bpf/rust/invoked/Cargo.toml # programs/bpf/rust/iter/Cargo.toml # programs/bpf/rust/many_args/Cargo.toml # programs/bpf/rust/many_args_dep/Cargo.toml # programs/bpf/rust/noop/Cargo.toml # programs/bpf/rust/panic/Cargo.toml # programs/bpf/rust/param_passing/Cargo.toml # programs/bpf/rust/param_passing_dep/Cargo.toml # programs/bpf/rust/rand/Cargo.toml # programs/bpf/rust/ristretto/Cargo.toml # programs/bpf/rust/sanity/Cargo.toml # programs/bpf/rust/sha256/Cargo.toml # programs/bpf/rust/sysval/Cargo.toml * Only activate legacy program feature for the solana-sdk crate (cherry picked from commit 85c51f5787895c97220d3a2f8ce9be6b9cbdd6c6) * Run serum-dex unit tests (cherry picked from commit 92ce381d60d65a73973fc20cdd4772334f973b96) * Rename solana-program-sdk to solana-program (cherry picked from commit dd711ab5fbf96c1efcfdf9488397e8af2568182a) # Conflicts: # programs/bpf/rust/128bit/Cargo.toml # programs/bpf/rust/128bit_dep/Cargo.toml # programs/bpf/rust/alloc/Cargo.toml # programs/bpf/rust/call_depth/Cargo.toml # programs/bpf/rust/custom_heap/Cargo.toml # programs/bpf/rust/dep_crate/Cargo.toml # programs/bpf/rust/deprecated_loader/Cargo.toml # programs/bpf/rust/dup_accounts/Cargo.toml # programs/bpf/rust/error_handling/Cargo.toml # programs/bpf/rust/external_spend/Cargo.toml # programs/bpf/rust/instruction_introspection/Cargo.toml # programs/bpf/rust/invoke/Cargo.toml # programs/bpf/rust/invoked/Cargo.toml # programs/bpf/rust/iter/Cargo.toml # programs/bpf/rust/many_args/Cargo.toml # programs/bpf/rust/many_args_dep/Cargo.toml # programs/bpf/rust/noop/Cargo.toml # programs/bpf/rust/panic/Cargo.toml # programs/bpf/rust/param_passing/Cargo.toml # programs/bpf/rust/param_passing_dep/Cargo.toml # programs/bpf/rust/rand/Cargo.toml # programs/bpf/rust/ristretto/Cargo.toml # programs/bpf/rust/sanity/Cargo.toml # programs/bpf/rust/sha256/Cargo.toml # programs/bpf/rust/sysval/Cargo.toml * Update frozen_abi hashes The movement of files in sdk/ caused ABI hashes to change (cherry picked from commit a4956844bdd081e7b90508066c579f29be306ce7) * Resolve merge conflicts Co-authored-by: Michael Vines <mvines@gmail.com>
2020-10-24 17:25:22 +00:00
# BPF solana-sdk legacy compile test
./cargo-build-bpf --manifest-path sdk/Cargo.toml
# BPF program tests
_ make -C programs/bpf/c tests
_ "$cargo" stable test \
--manifest-path programs/bpf/Cargo.toml \
--no-default-features --features=bpf_c,bpf_rust -- --nocapture
2019-02-27 08:18:29 -08:00
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
2019-09-26 13:36:51 -07:00
# Force CUDA for solana-core unit tests
export TEST_PERF_LIBS_CUDA=1
# Force CUDA in ci/localnet-sanity.sh
export SOLANA_CUDA=1
2019-02-27 08:18:29 -08:00
fi
_ "$cargo" stable build --bins ${V:+--verbose}
_ "$cargo" stable test --package solana-perf --package solana-ledger --package solana-core --lib ${V:+--verbose} -- --nocapture
_ "$cargo" stable run --manifest-path poh-bench/Cargo.toml ${V:+--verbose} -- --hashes-per-tick 10
;;
test-local-cluster)
_ "$cargo" stable build --release --bins ${V:+--verbose}
_ "$cargo" stable test --release --package solana-local-cluster ${V:+--verbose} -- --nocapture --test-threads=1
exit 0
;;
*)
echo "Error: Unknown test: $testName"
;;
esac
2018-07-30 12:51:35 -07:00
(
export CARGO_TOOLCHAIN=+"$rust_stable"
echo --- ci/localnet-sanity.sh
ci/localnet-sanity.sh -x
echo --- ci/run-sanity.sh
ci/run-sanity.sh -x
2018-07-30 12:51:35 -07:00
)