solana/ci/test-bench.sh

58 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
2018-08-13 15:57:23 -07:00
cd "$(dirname "$0")/.."
annotate() {
${BUILDKITE:-false} && {
buildkite-agent annotate "$@"
}
}
ci/affects-files.sh \
2018-12-18 17:33:28 -08:00
.rs$ \
Cargo.lock$ \
Cargo.toml$ \
2018-12-18 17:33:28 -08:00
ci/test-bench.sh \
|| {
2018-12-18 17:33:28 -08:00
annotate --style info --context test-bench \
"Bench skipped as no .rs files were modified"
exit 0
}
2018-12-18 14:25:10 -08:00
source ci/_
source ci/upload-ci-artifact.sh
eval "$(ci/channel-info.sh)"
source ci/rust-version.sh nightly
2018-08-13 15:57:23 -07:00
2018-09-24 10:20:58 -07:00
set -o pipefail
export RUST_BACKTRACE=1
2018-09-24 10:20:58 -07:00
UPLOAD_METRICS=""
TARGET_BRANCH=$BUILDKITE_BRANCH
if [[ -z $BUILDKITE_BRANCH ]] || ./ci/is-pr.sh; then
TARGET_BRANCH=$EDGE_CHANNEL
else
UPLOAD_METRICS="upload"
fi
BENCH_FILE=bench_output.log
BENCH_ARTIFACT=current_bench_results.log
_ cargo +$rust_nightly bench ${V:+--verbose} \
-- -Z unstable-options --format=json | tee "$BENCH_FILE"
# Run bpf benches
echo --- program/bpf
(
set -x
cd programs/bpf
cargo +$rust_nightly bench ${V:+--verbose} --features=bpf_c \
-- -Z unstable-options --format=json --nocapture | tee -a ../../../"$BENCH_FILE"
)
_ cargo +$rust_nightly run --release --package solana-upload-perf \
-- "$BENCH_FILE" "$TARGET_BRANCH" "$UPLOAD_METRICS" > "$BENCH_ARTIFACT"
upload-ci-artifact "$BENCH_ARTIFACT"