Added dash env files for testing environment

This commit is contained in:
Evan Duffield 2016-05-20 12:42:46 -07:00
parent e76ec696b6
commit 184efef864
3 changed files with 134 additions and 54 deletions

72
env/evan-macosx-develop.bash vendored Normal file
View File

@ -0,0 +1,72 @@
############## Dash Project Commands #####################
#
# An easy to use way of testing dash core
#
# ATTENTION:
# **** change these each project, so that the default is correct usually ****
#
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $DIR/misc.bash
DASHLOG="mnbudget,mnpayments"
DASHDEBUG="lldb --"
DASHBINARY="./dashd"
DASHDIR="dash/testnet"
DASHBINARY="./dashd"
DASHNETWORK="testnet"
cmd_dash()
{
if [ "$1" = "help" ]; then
echo "dash command center";
echo " example: dash set debug on"
echo "-----------------------------------";
echo "";
echo "setting up environment:";
echo " set debug on|off (lldb mode)";
echo " set mode qt|daemon";
echo " set log options";
echo "";
echo "starting/stopping the client:";
echo " start";
echo " stop";
echo "";
echo "using cli:";
echo " cli [options]";
echo "";
fi;
#---- debug mode off/on
if [ "$1 $2 $3" = "set debug on" ]; then DASHDEBUG="lldb --"; echo "debug mode on"; return; fi;
if [ "$1 $2 $3" = "set debug off" ]; then DASHDEBUG=""; echo "debug mode off"; return; fi;
if [ "$1 $2" = "set debug" ]; then return; fi;
#---- setup binaries
if [ "$1 $2 $3" = "set mode qt" ]; then DASHBINARY="./dash-qt";echo "qt mode on"; return; fi;
if [ "$1 $2 $3" = "set mode daemon" ]; then DASHBINARY="./dashd";echo "daemon mode on"; return; fi;
if [ "$1 $2" = "set mode" ]; then return; fi;
#---- generic commands
if [ "$1" = "start" ]; then $DASHDEBUG ~/$DASHDIR/bin/$DASHBINARY --datadir=$DIR/../../data --debug=$DASHLOG -logthreadnames; return; fi;
if [ "$1 $2" = "hard start" ]; then $DASHDEBUG ~/$DASHDIR/bin/$DASHBINARY --datadir=$DIR/../../data --debug=$DASHLOG -reindex -logthreadnames; return; fi;
if [ "$1" = "cd" ]; then cd ~/$DASHDIR/src; return; fi;
#---- tail $DASHDIR/network/debug.log
if [ "$1 $DASHNETWORK" = "tail testnet" ]; then cd ~/$DASHDIR/data/testnet3 && tail -f debug.log ; return; fi;
if [ "$1 $DASHNETWORK" = "tail mainnet" ]; then cd ~/$DASHDIR/data && tail -f debug.log ; return; fi;
if [ "$1 $DASHNETWORK" = "tail regtest" ]; then cd ~/$DASHDIR/data/regtest && tail -f debug.log ; return; fi;
array=$@;
array="${array[@]:3}";
echo $array;
echo "$DIR/../../data"
#----- cli commands
if [ "$1" = "cli" ]; then cd ~/$DASHDIR/bin && ./dash-cli --datadir=$DIR/../../data $array; return; fi;
echo "unknown dash command. see 'dash help'"
}
alias dash=cmd_dash;

View File

@ -6,65 +6,17 @@
# **** change these each project, so that the default is correct usually ****
#
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $DIR/misc.bash
HOMEUSER="evan"
DASHLOG="mnbudget,mnpayments"
DASHDEBUG="lldb --"
DASHBINARY="./dashd"
DASHNETWORK="testnet" #mainnet, testnet, regtest
DASHDIR=".dash-develop"
#DASHBINARY="./dash-qt"
DASHDIR="./dash/develop"
DASHBINARY="./dash/bin/develop/dashd"
touch_logs()
{
touch ~/.dash/debug.log;
for ((i=2;i<=9;i++));
do
touch ~/.dash$i/debug.log;
done
}
stop_cluster()
{
./dash-cli --datadir=/Users/$HOMEUSER/.dash stop
for ((i=2;i<=9;i++));
do
echo "stopping dash$i "
./dash-cli --datadir=/Users/$HOMEUSER/.dash$i stop
done
}
start_cluster()
{
for ((i=1;i<=9;i++));
do
echo "starting dash$i "
./dashd --datadir=/Users/$HOMEUSER/.dash$i --daemon
done
}
cmd_cluster()
{
array=$@;
re='^[0-9]$'
locked="any";
if [[ $1 =~ $re ]] ; then
#if the first parameter is a number, we'll assume we want to execute that specific daemon
locked=$1;
array="${array[@]:1}";
fi;
for ((i=1;i<=9;i++));
do
if [ $locked == $i ] ; then
echo "dash$i $array"
./dash-cli --datadir=/Users/$HOMEUSER/.dash$i $array
fi;
if [ $locked = "any" ] ; then
echo "dash$i "
./dash-cli --datadir=/Users/$HOMEUSER/.dash$i $array
fi;
done
}
source misc.bash
cmd_dash()
{
@ -96,6 +48,8 @@ cmd_dash()
#---- setup binaries
if [ "$1 $2 $3" = "set mode qt" ]; then DASHBINARY="./dash-qt";echo "qt mode on"; return; fi;
if [ "$1 $2 $3" = "set mode daemon" ]; then DASHBINARY="./dashd";echo "daemon mode on"; return; fi;
if [ "$1 $2 $3" = "set mode testnet" ]; then DASHBINARY="./dash-qt";echo "qt mode on"; return; fi;
if [ "$1 $2 $3" = "set mode mainnet" ]; then DASHBINARY="./dashd";echo "daemon mode on"; return; fi;
if [ "$1 $2" = "set mode" ]; then return; fi;
#---- generic commands

54
env/misc.bash vendored Normal file
View File

@ -0,0 +1,54 @@
touch_logs()
{
touch ~/.dash/debug.log;
for ((i=2;i<=9;i++));
do
touch ~/.dash$i/debug.log;
done
}
stop_cluster()
{
./dash-cli --datadir=/Users/$HOMEUSER/.dash stop
for ((i=2;i<=9;i++));
do
echo "stopping dash$i "
./dash-cli --datadir=/Users/$HOMEUSER/.dash$i stop
done
}
start_cluster()
{
for ((i=1;i<=9;i++));
do
echo "starting dash$i "
./dashd --datadir=/Users/$HOMEUSER/.dash$i --daemon
done
}
cmd_cluster()
{
array=$@;
re='^[0-9]$'
locked="any";
if [[ $1 =~ $re ]] ; then
#if the first parameter is a number, we'll assume we want to execute that specific daemon
locked=$1;
array="${array[@]:1}";
fi;
for ((i=1;i<=9;i++));
do
if [ $locked == $i ] ; then
echo "dash$i $array"
./dash-cli --datadir=/Users/$HOMEUSER/.dash$i $array
fi;
if [ $locked = "any" ] ; then
echo "dash$i "
./dash-cli --datadir=/Users/$HOMEUSER/.dash$i $array
fi;
done
}