Configurable harness directory. (#309)

Add a -r flag to the harness script which enables the default root directory to be changed.
This commit is contained in:
Jamie Holdstock 2021-11-29 19:34:47 +00:00 committed by GitHub
parent 0919c6db29
commit 913b38bf14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2020 The Decred developers # Copyright (c) 2020-2021 The Decred developers
# Use of this source code is governed by an ISC # Use of this source code is governed by an ISC
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# #
@ -8,12 +8,16 @@
# #
# To use the script simply run `./harness.sh` from the repo root. # To use the script simply run `./harness.sh` from the repo root.
# #
# The script makes a few assumptions about the system it is running on: # By default, the harness script will use `/tmp/vspd-harness` as a working
# directory. This can be changed using the `-r` flag, eg:
#
# ./harness.sh -r /my/harness/path
#
# The harness script makes a few assumptions about the system it is running on:
# - tmux is installed # - tmux is installed
# - dcrd, dcrwallet and vspd are available on $PATH # - dcrd, dcrwallet and vspd are available on $PATH
# - Decred testnet chain is already downloaded and sync'd # - Decred testnet chain is already downloaded and sync'd
# - dcrd transaction index is already built # - dcrd transaction index is already built
# - /tmp directory exists
# - The following files exist: # - The following files exist:
# - ${HOME}/.dcrd/rpc.cert # - ${HOME}/.dcrd/rpc.cert
# - ${HOME}/.dcrd/rpc.key # - ${HOME}/.dcrd/rpc.key
@ -23,7 +27,6 @@
set -e set -e
TMUX_SESSION="vspd-harness" TMUX_SESSION="vspd-harness"
HARNESS_ROOT=/tmp/vspd-harness
RPC_USER="user" RPC_USER="user"
RPC_PASS="pass" RPC_PASS="pass"
NUMBER_OF_WALLETS=3 NUMBER_OF_WALLETS=3
@ -37,7 +40,13 @@ WALLET_RPC_KEY="${HOME}/.dcrwallet/rpc.key"
VSPD_FEE_XPUB="tpubVppjaMjp8GEWzpMGHdXNhkjqof8baKGkUzneNEiocnnjnjY9hQPe6mxzZQyzyKYS3u5yxLp8KrJvibqDzc75RGqzkv2JMPYDXmCRR1a39jg" VSPD_FEE_XPUB="tpubVppjaMjp8GEWzpMGHdXNhkjqof8baKGkUzneNEiocnnjnjY9hQPe6mxzZQyzyKYS3u5yxLp8KrJvibqDzc75RGqzkv2JMPYDXmCRR1a39jg"
tmux new-session -d -s $TMUX_SESSION HARNESS_ROOT=/tmp/vspd-harness
while getopts r: flag
do
case "${flag}" in
r) HARNESS_ROOT=${OPTARG};
esac
done
if [ -d "${HARNESS_ROOT}" ]; then if [ -d "${HARNESS_ROOT}" ]; then
while true; do while true; do
@ -51,6 +60,8 @@ if [ -d "${HARNESS_ROOT}" ]; then
done done
fi fi
tmux new-session -d -s $TMUX_SESSION
################################################# #################################################
# Setup dcrd. # Setup dcrd.
################################################# #################################################