net: net.sh - Enable deploying testnets on debug binaries (#5627)

automerge
This commit is contained in:
Trent Nelson
2019-08-23 19:31:18 -06:00
committed by Grimes
parent 881a6dc0f7
commit 6bb22902cc
2 changed files with 23 additions and 4 deletions

View File

@ -39,6 +39,7 @@ Operate a configured testnet
(ignored if -s or -S is specified) (ignored if -s or -S is specified)
-r - Reuse existing node/ledger configuration from a -r - Reuse existing node/ledger configuration from a
previous |start| (ie, don't run ./multinode-demo/setup.sh). previous |start| (ie, don't run ./multinode-demo/setup.sh).
-d / --debug - Build/deploy the testnet with debug binaries
-D /path/to/programs - Deploy custom programs from this location -D /path/to/programs - Deploy custom programs from this location
-c clientType=numClients=extraArgs - Number of clientTypes to start. This options can be specified -c clientType=numClients=extraArgs - Number of clientTypes to start. This options can be specified
more than once. Defaults to bench-tps for all clients if not more than once. Defaults to bench-tps for all clients if not
@ -122,6 +123,8 @@ internalNodesLamports=
maybeNoSnapshot="" maybeNoSnapshot=""
maybeSkipLedgerVerify="" maybeSkipLedgerVerify=""
maybeDisableAirdrops="" maybeDisableAirdrops=""
buildProfile="--release"
debugBuild=false
command=$1 command=$1
[[ -n $command ]] || usage [[ -n $command ]] || usage
@ -164,6 +167,9 @@ while [[ -n $1 ]]; do
elif [[ $1 = --no-airdrop ]]; then elif [[ $1 = --no-airdrop ]]; then
maybeDisableAirdrops="$1" maybeDisableAirdrops="$1"
shift 1 shift 1
elif [[ $1 = --debug ]]; then
debugBuild=true
shift 1
else else
usage "Unknown long option: $1" usage "Unknown long option: $1"
fi fi
@ -173,7 +179,7 @@ while [[ -n $1 ]]; do
fi fi
done done
while getopts "h?T:t:o:f:rD:c:Fn:i:" opt "${shortArgs[@]}"; do while getopts "h?T:t:o:f:rD:c:Fn:i:d" opt "${shortArgs[@]}"; do
case $opt in case $opt in
h | \?) h | \?)
usage usage
@ -255,12 +261,17 @@ while getopts "h?T:t:o:f:rD:c:Fn:i:" opt "${shortArgs[@]}"; do
i) i)
nodeAddress=$OPTARG nodeAddress=$OPTARG
;; ;;
d)
debugBuild=true
;;
*) *)
usage "Error: unhandled option: $opt" usage "Error: unhandled option: $opt"
;; ;;
esac esac
done done
$debugBuild && buildProfile=""
loadConfigFile loadConfigFile
if [[ -n $numFullnodesRequested ]]; then if [[ -n $numFullnodesRequested ]]; then
@ -317,7 +328,7 @@ build() {
fi fi
$MAYBE_DOCKER bash -c " $MAYBE_DOCKER bash -c "
set -ex set -ex
scripts/cargo-install-all.sh farf \"$cargoFeatures\" scripts/cargo-install-all.sh farf \"$cargoFeatures\" \"$buildProfile\"
if [[ -n \"$customPrograms\" ]]; then if [[ -n \"$customPrograms\" ]]; then
scripts/cargo-install-custom-programs.sh farf $customPrograms scripts/cargo-install-custom-programs.sh farf $customPrograms
fi fi

View File

@ -17,6 +17,14 @@ fi
installDir="$(mkdir -p "$1"; cd "$1"; pwd)" installDir="$(mkdir -p "$1"; cd "$1"; pwd)"
cargoFeatures="$2" cargoFeatures="$2"
buildProfile="$3"
if [[ -n "$buildProfile" ]]; then
binTargetDir="release"
else
binTargetDir="debug"
fi
echo "Install location: $installDir" echo "Install location: $installDir"
cd "$(dirname "$0")"/.. cd "$(dirname "$0")"/..
@ -26,7 +34,7 @@ SECONDS=0
( (
set -x set -x
# shellcheck disable=SC2086 # Don't want to double quote $rust_version # shellcheck disable=SC2086 # Don't want to double quote $rust_version
cargo $rust_version build --all --release --features="$cargoFeatures" cargo $rust_version build --all $buildProfile --features="$cargoFeatures"
) )
BIN_CRATES=( BIN_CRATES=(
@ -53,7 +61,7 @@ for crate in "${BIN_CRATES[@]}"; do
done done
for dir in programs/*; do for dir in programs/*; do
for program in echo target/release/deps/libsolana_"$(basename "$dir")".{so,dylib,dll}; do for program in echo target/$binTargetDir/deps/libsolana_"$(basename "$dir")".{so,dylib,dll}; do
if [[ -f $program ]]; then if [[ -f $program ]]; then
mkdir -p "$installDir/bin/deps" mkdir -p "$installDir/bin/deps"
rm -f "$installDir/bin/deps/$(basename "$program")" rm -f "$installDir/bin/deps/$(basename "$program")"