solana/cargo-test-bpf

21 lines
569 B
Bash
Executable File

#!/usr/bin/env bash
here=$(dirname "$0")
maybe_bpf_sdk="--bpf-sdk $here/sdk/bpf"
for a in "$@"; do
if [[ $a = --bpf-sdk ]]; then
maybe_bpf_sdk=
fi
done
export CARGO_BUILD_BPF="$here"/cargo-build-bpf
set -x
if [[ ! -f "$here"/target/debug/cargo-build-sbf ]]; then
cargo build --manifest-path "$here"/sdk/cargo-build-sbf/Cargo.toml
fi
if [[ ! -f "$here"/target/debug/cargo-test-sbf ]]; then
cargo build --manifest-path "$here"/sdk/cargo-test-sbf/Cargo.toml
fi
exec cargo run --manifest-path "$here"/sdk/cargo-test-bpf/Cargo.toml -- $maybe_bpf_sdk "$@"