From 33a9370c99fb95bd4ce92662204954aafefa3ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Thu, 5 Sep 2019 12:55:47 +0200 Subject: [PATCH] improve tests/simulation/start.sh and friends [skip ci] --- Makefile | 2 +- tests/simulation/run_node.sh | 6 +++--- tests/simulation/start.sh | 13 ++++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 48e68462a..3c2b6a2bb 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ clean_eth2_network_simulation_files: rm -rf tests/simulation/{data,validators} eth2_network_simulation: | build deps p2pd clean_eth2_network_simulation_files - GIT_ROOT="$$PWD" BUILD_OUTPUTS_DIR="./build" $(ENV_SCRIPT) tests/simulation/start.sh + GIT_ROOT="$$PWD" BUILD_OUTPUTS_DIR="./build" tests/simulation/start.sh testnet0 testnet1: | build deps p2pd NIM_PARAMS="$(NIM_PARAMS)" $(ENV_SCRIPT) scripts/build_testnet_node.sh $@ diff --git a/tests/simulation/run_node.sh b/tests/simulation/run_node.sh index 8270b8eb3..040b51c2b 100755 --- a/tests/simulation/run_node.sh +++ b/tests/simulation/run_node.sh @@ -2,7 +2,7 @@ set -eu -. $(dirname $0)/vars.sh +source "$(dirname "$0")/vars.sh" cd "$GIT_ROOT" DATA_DIR="${SIMULATION_DIR}/node-${1}" @@ -21,9 +21,9 @@ LAST_VALIDATOR_IDX=$(( (NUM_VALIDATORS / ($NUM_NODES + $NUM_MISSING_NODES)) * ($ mkdir -p $DATA_DIR/validators rm -f $DATA_DIR/validators/* -pushd $VALIDATORS_DIR +pushd $VALIDATORS_DIR >/dev/null cp $(seq -s " " -f v%07g.privkey $FIRST_VALIDATOR_IDX $LAST_VALIDATOR_IDX) $DATA_DIR/validators -popd +popd >/dev/null $BEACON_NODE_BIN \ --network:$NETWORK_METADATA_FILE \ diff --git a/tests/simulation/start.sh b/tests/simulation/start.sh index ee933b9ff..8a074219a 100755 --- a/tests/simulation/start.sh +++ b/tests/simulation/start.sh @@ -1,9 +1,12 @@ #!/bin/bash -set -euo pipefail +set -eo pipefail # Read in variables -. "$(dirname "$0")/vars.sh" +source "$(dirname "$0")/vars.sh" + +# set up the environment +source "${SIM_ROOT}/../../env.sh" # Set DEPOSIT_WEB3_URL_ARG to empty to get genesis state from file, not using web3 # export DEPOSIT_WEB3_URL_ARG=--depositWeb3Url=ws://localhost:8545 @@ -16,7 +19,7 @@ mkdir -p "$VALIDATORS_DIR" cd "$GIT_ROOT" -NIMFLAGS="-d:chronicles_log_level=DEBUG --hints:off --opt:speed --debuginfo" +NIMFLAGS="-d:chronicles_log_level=DEBUG --hints:off --warnings:off --opt:speed --debuginfo" # Run with "SHARD_COUNT=4 ./start.sh" to change these DEFS="" @@ -29,11 +32,11 @@ LAST_VALIDATOR_NUM=$(( NUM_VALIDATORS - 1 )) LAST_VALIDATOR="$VALIDATORS_DIR/v$(printf '%07d' $LAST_VALIDATOR_NUM).deposit.json" echo "Building $BEACON_NODE_BIN ($DEFS)" -"$SIM_ROOT/../../env.sh" nim c -o:"$BEACON_NODE_BIN" $NIMFLAGS $DEFS beacon_chain/beacon_node +nim c -o:"$BEACON_NODE_BIN" $NIMFLAGS $DEFS beacon_chain/beacon_node if [ ! -f "${LAST_VALIDATOR}" ]; then echo Building $DEPLOY_DEPOSIT_CONTRACT_BIN - "$SIM_ROOT/../../env.sh" nim c -o:"$DEPLOY_DEPOSIT_CONTRACT_BIN" $NIMFLAGS $DEFS --hints:off -d:release beacon_chain/deploy_deposit_contract + nim c -o:"$DEPLOY_DEPOSIT_CONTRACT_BIN" $NIMFLAGS $DEFS -d:release beacon_chain/deploy_deposit_contract if [ "$DEPOSIT_WEB3_URL_ARG" != "" ]; then DEPOSIT_CONTRACT_ADDRESS=$($DEPLOY_DEPOSIT_CONTRACT_BIN $DEPOSIT_WEB3_URL_ARG)