Run featurized tests on sub-packages (#2867)
This commit is contained in:
parent
4602d3bf46
commit
3610768888
|
@ -14,8 +14,6 @@ edition = "2018"
|
||||||
codecov = { repository = "solana-labs/solana", branch = "master", service = "github" }
|
codecov = { repository = "solana-labs/solana", branch = "master", service = "github" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
bpf_c = []
|
|
||||||
bpf_rust = []
|
|
||||||
chacha = []
|
chacha = []
|
||||||
cuda = []
|
cuda = []
|
||||||
erasure = []
|
erasure = []
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Runs all integration tests in the tree serially
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
maybeFeatures=
|
|
||||||
if [[ -n $1 ]]; then
|
|
||||||
maybeFeatures="--features=$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
|
||||||
source ci/_
|
|
||||||
export RUST_BACKTRACE=1
|
|
||||||
source scripts/ulimit-n.sh
|
|
||||||
|
|
||||||
for test in {,*/}tests/*.rs; do
|
|
||||||
test=${test##*/} # basename x
|
|
||||||
test=${test%.rs} # basename x .rs
|
|
||||||
(
|
|
||||||
export RUST_LOG="$test"=trace,$RUST_LOG
|
|
||||||
# shellcheck disable=SC2086 # Don't want to double quote $maybeFeatures
|
|
||||||
_ cargo test --all ${V:+--verbose} $maybeFeatures --test="$test" \
|
|
||||||
-- --test-threads=1 --nocapture
|
|
||||||
)
|
|
||||||
done
|
|
|
@ -1,45 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
cd "$(dirname "$0")/.."
|
|
||||||
|
|
||||||
annotate() {
|
|
||||||
${BUILDKITE:-false} && {
|
|
||||||
buildkite-agent annotate "$@"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ci/affects-files.sh \
|
|
||||||
.rs$ \
|
|
||||||
Cargo.lock$ \
|
|
||||||
Cargo.toml$ \
|
|
||||||
ci/test-stable-perf.sh \
|
|
||||||
ci/test-stable.sh \
|
|
||||||
|| {
|
|
||||||
annotate --style info --context test-stable-perf \
|
|
||||||
"Stable Perf skipped as no .rs files were modified"
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run all BPF C tests
|
|
||||||
make -C programs/bpf/c tests
|
|
||||||
|
|
||||||
# Must be built out of band
|
|
||||||
make -C programs/bpf/rust/noop/ all
|
|
||||||
|
|
||||||
FEATURES=bpf_c,bpf_rust,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
|
|
||||||
FEATURES=$FEATURES,cuda
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec ci/test-stable.sh "$FEATURES"
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
test-stable.sh
|
|
@ -1,42 +1,100 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
FEATURES="$1"
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
source ci/_
|
||||||
|
|
||||||
|
annotate() {
|
||||||
|
${BUILDKITE:-false} && {
|
||||||
|
buildkite-agent annotate "$@"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ci/version-check-with-upgrade.sh stable
|
||||||
|
export RUST_BACKTRACE=1
|
||||||
|
export RUSTFLAGS="-D warnings"
|
||||||
|
source scripts/ulimit-n.sh
|
||||||
|
|
||||||
# Clear cached json keypair files
|
# Clear cached json keypair files
|
||||||
rm -rf "$HOME/.config/solana"
|
rm -rf "$HOME/.config/solana"
|
||||||
|
|
||||||
source ci/_
|
# Run tbe appropriate test based on entrypoint
|
||||||
ci/version-check-with-upgrade.sh stable
|
testName=$(basename "$0" .sh)
|
||||||
export RUST_BACKTRACE=1
|
case $testName in
|
||||||
export RUSTFLAGS="-D warnings"
|
test-stable)
|
||||||
|
echo "Executing $testName"
|
||||||
|
|
||||||
source scripts/ulimit-n.sh
|
_ cargo build --all ${V:+--verbose}
|
||||||
maybeFeatures=
|
_ cargo test --all ${V:+--verbose} -- --nocapture --test-threads=1
|
||||||
if [[ -n $FEATURES ]]; then
|
;;
|
||||||
maybeFeatures="--features=$FEATURES"
|
test-stable-perf)
|
||||||
|
echo "Executing $testName"
|
||||||
|
|
||||||
|
ci/affects-files.sh \
|
||||||
|
.rs$ \
|
||||||
|
Cargo.lock$ \
|
||||||
|
Cargo.toml$ \
|
||||||
|
ci/test-stable-perf.sh \
|
||||||
|
ci/test-stable.sh \
|
||||||
|
|| {
|
||||||
|
annotate --style info \
|
||||||
|
"Skipped tests as no relavant files were modified"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run program package with these features
|
||||||
|
PROGRAM_FEATURES=bpf_c,bpf_rust
|
||||||
|
|
||||||
|
# Run all BPF C tests
|
||||||
|
_ make -C programs/bpf/c tests
|
||||||
|
|
||||||
|
# Must be built out of band
|
||||||
|
_ make -C programs/bpf/rust/noop/ all
|
||||||
|
|
||||||
|
_ cargo test --manifest-path programs/Cargo.toml --no-default-features --features="$PROGRAM_FEATURES"
|
||||||
|
_ cargo test --manifest-path programs/native/bpf_loader/Cargo.toml --no-default-features --features="$PROGRAM_FEATURES"
|
||||||
|
|
||||||
|
# Run root package tests witht these features
|
||||||
|
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
|
fi
|
||||||
# shellcheck disable=SC2086 # Don't want to double quote $maybeFeatures
|
|
||||||
_ cargo build --all ${V:+--verbose} $maybeFeatures
|
|
||||||
# shellcheck disable=SC2086 # Don't want to double quote $maybeFeatures
|
|
||||||
_ cargo test --all ${V:+--verbose} $maybeFeatures --lib -- --nocapture --test-threads=1
|
|
||||||
|
|
||||||
# Run native program tests (without $FEATURES)
|
# Run root package library tests
|
||||||
for program in programs/native/*; do
|
_ cargo build ${V:+--verbose} --features="$ROOT_FEATURES"
|
||||||
echo --- "$program" test
|
_ cargo test --lib ${V:+--verbose} --features="$ROOT_FEATURES" -- --nocapture --test-threads=1
|
||||||
|
|
||||||
|
# Run root package integration tests
|
||||||
|
for test in tests/*.rs; do
|
||||||
|
test=${test##*/} # basename x
|
||||||
|
test=${test%.rs} # basename x .rs
|
||||||
(
|
(
|
||||||
set -x
|
export RUST_LOG="$test"=trace,$RUST_LOG
|
||||||
cd "$program"
|
_ cargo test ${V:+--verbose} --features="$ROOT_FEATURES" --test="$test" \
|
||||||
cargo test ${V:+--verbose} -- --nocapture
|
-- --test-threads=1 --nocapture
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Error: Unknown test: $testName"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
_ ci/integration-tests.sh "$FEATURES"
|
# Assumes target/debug is populated. Ensure last build command
|
||||||
|
# leaves target/debug in the state intended for localnet-sanity
|
||||||
echo --- ci/localnet-sanity.sh
|
echo --- ci/localnet-sanity.sh
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
# Assume |cargo build| has populated target/debug/ successfully.
|
|
||||||
export PATH=$PWD/target/debug:$PATH
|
export PATH=$PWD/target/debug:$PATH
|
||||||
USE_INSTALL=1 ci/localnet-sanity.sh -x
|
USE_INSTALL=1 ci/localnet-sanity.sh -x
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue