From 1adc83d1487f6a1ee0f96c0c3156464779ffb2a8 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 30 Jul 2018 12:51:35 -0700 Subject: [PATCH] Add localnet-sanity.sh --- ci/localnet-sanity.sh | 61 +++++++++++++++++++++++++++++++++++++++++++ ci/test-stable.sh | 8 ++++++ 2 files changed, 69 insertions(+) create mode 100755 ci/localnet-sanity.sh diff --git a/ci/localnet-sanity.sh b/ci/localnet-sanity.sh new file mode 100755 index 000000000..59b7d346d --- /dev/null +++ b/ci/localnet-sanity.sh @@ -0,0 +1,61 @@ +#!/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 + +./multinode-demo/setup.sh + +backgroundCommands="drone leader validator" +pids=() + +for cmd in $backgroundCommands; do + echo "--- Start $cmd" + rm -f log-"$cmd".txt + ./multinode-demo/"$cmd".sh > log-"$cmd".txt 2>&1 & + declare pid=$! + pids+=("$pid") + echo "pid: $pid" +done + +shutdown() { + set +e + echo --- Shutdown + for pid in "${pids[@]}"; do + if kill "$pid"; then + wait "$pid" + else + echo -e "^^^ +++\\nWarning: unable to kill $pid" + fi + done + + for cmd in $backgroundCommands; do + declare logfile=log-$cmd.txt + upload_ci_artifact "$logfile" + tail "$logfile" + done +} + +trap shutdown EXIT + +set -e + +echo "--- Wallet sanity" +( + set -x + multinode-demo/test/wallet-sanity.sh +) + +echo "--- Node count" +( + set -x + ./multinode-demo/client.sh "$PWD" 2 -c --addr 127.0.0.1 +) + + +echo +++ +echo Ok +exit 0 diff --git a/ci/test-stable.sh b/ci/test-stable.sh index fea943e7e..db0ace6f6 100755 --- a/ci/test-stable.sh +++ b/ci/test-stable.sh @@ -16,3 +16,11 @@ _ cargo fmt -- --write-mode=check _ cargo build --verbose _ cargo test --verbose _ cargo bench --verbose + +echo --- ci/localnet-sanity.sh +( + set -x + # Assume |cargo build| has populated target/debug/ successfully. + export PATH=$PWD/target/debug:$PATH + USE_INSTALL=1 ci/localnet-sanity.sh +)