2018-07-30 12:51:35 -07:00
|
|
|
#!/bin/bash -e
|
|
|
|
#
|
|
|
|
# Perform a quick sanity test on a leader, drone, validator and client running
|
|
|
|
# locally on the same machine
|
|
|
|
#
|
|
|
|
|
|
|
|
cd "$(dirname "$0")"/..
|
|
|
|
source ci/upload_ci_artifact.sh
|
2018-08-27 10:23:22 -07:00
|
|
|
source scripts/configure-metrics.sh
|
2018-07-30 12:51:35 -07:00
|
|
|
|
2018-08-27 10:23:22 -07:00
|
|
|
multinode-demo/setup.sh
|
2018-07-30 12:51:35 -07:00
|
|
|
|
2018-08-03 14:56:35 -07:00
|
|
|
backgroundCommands="drone leader validator validator-x"
|
2018-07-30 12:51:35 -07:00
|
|
|
pids=()
|
|
|
|
|
|
|
|
for cmd in $backgroundCommands; do
|
|
|
|
echo "--- Start $cmd"
|
|
|
|
rm -f log-"$cmd".txt
|
2018-08-27 10:23:22 -07:00
|
|
|
multinode-demo/"$cmd".sh > log-"$cmd".txt 2>&1 &
|
2018-07-30 12:51:35 -07:00
|
|
|
declare pid=$!
|
|
|
|
pids+=("$pid")
|
|
|
|
echo "pid: $pid"
|
|
|
|
done
|
|
|
|
|
2018-08-07 09:29:58 -07:00
|
|
|
killBackgroundCommands() {
|
2018-07-30 12:51:35 -07:00
|
|
|
set +e
|
|
|
|
for pid in "${pids[@]}"; do
|
|
|
|
if kill "$pid"; then
|
|
|
|
wait "$pid"
|
|
|
|
else
|
|
|
|
echo -e "^^^ +++\\nWarning: unable to kill $pid"
|
|
|
|
fi
|
|
|
|
done
|
2018-08-07 09:29:58 -07:00
|
|
|
set -e
|
|
|
|
pids=()
|
|
|
|
}
|
|
|
|
|
|
|
|
shutdown() {
|
|
|
|
exitcode=$?
|
|
|
|
killBackgroundCommands
|
|
|
|
|
|
|
|
set +e
|
2018-07-30 12:51:35 -07:00
|
|
|
|
2018-08-07 09:29:58 -07:00
|
|
|
echo "--- Upload artifacts"
|
2018-07-30 12:51:35 -07:00
|
|
|
for cmd in $backgroundCommands; do
|
|
|
|
declare logfile=log-$cmd.txt
|
|
|
|
upload_ci_artifact "$logfile"
|
|
|
|
tail "$logfile"
|
|
|
|
done
|
2018-07-30 17:09:05 -07:00
|
|
|
|
|
|
|
exit $exitcode
|
2018-07-30 12:51:35 -07:00
|
|
|
}
|
|
|
|
|
2018-07-30 17:09:05 -07:00
|
|
|
trap shutdown EXIT INT
|
2018-07-30 12:51:35 -07:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2018-08-14 11:31:52 -07:00
|
|
|
flag_error() {
|
|
|
|
echo Failed
|
|
|
|
echo "^^^ +++"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2018-08-27 17:57:04 -07:00
|
|
|
echo "--- Wallet sanity"
|
|
|
|
(
|
|
|
|
set -x
|
2018-09-07 09:46:21 -07:00
|
|
|
scripts/wallet-sanity.sh
|
2018-08-27 17:57:04 -07:00
|
|
|
) || flag_error
|
|
|
|
|
|
|
|
echo "--- Node count"
|
|
|
|
(
|
2018-09-07 15:07:10 -07:00
|
|
|
source multinode-demo/common.sh
|
2018-09-08 12:50:43 -07:00
|
|
|
set -x
|
2018-09-07 15:07:10 -07:00
|
|
|
client_id=/tmp/client-id.json-$$
|
|
|
|
$solana_keygen -o $client_id
|
2018-09-11 20:00:49 -07:00
|
|
|
$solana_bench_tps --identity $client_id --num-nodes 3 --reject-extra-nodes --converge-only
|
2018-09-07 15:07:10 -07:00
|
|
|
rm -rf $client_id
|
2018-08-27 17:57:04 -07:00
|
|
|
) || flag_error
|
2018-07-30 12:51:35 -07:00
|
|
|
|
2018-08-07 09:29:58 -07:00
|
|
|
killBackgroundCommands
|
2018-08-14 11:31:52 -07:00
|
|
|
|
|
|
|
echo "--- Ledger verification"
|
|
|
|
(
|
2018-08-27 10:23:22 -07:00
|
|
|
source multinode-demo/common.sh
|
2018-09-08 12:50:43 -07:00
|
|
|
set -x
|
2018-08-27 17:57:04 -07:00
|
|
|
cp -R "$SOLANA_CONFIG_DIR"/ledger /tmp/ledger-$$
|
|
|
|
$solana_ledger_tool --ledger /tmp/ledger-$$ verify
|
|
|
|
rm -rf /tmp/ledger-$$
|
2018-08-14 11:31:52 -07:00
|
|
|
) || flag_error
|
2018-07-30 12:51:35 -07:00
|
|
|
|
|
|
|
echo +++
|
|
|
|
echo Ok
|
|
|
|
exit 0
|