Skip to content

Commit 6e8f9ce

Browse files
committed
update the testnet.template and tn_up/down scripts for EOSIO#2111
1 parent a501237 commit 6e8f9ce

File tree

4 files changed

+28
-63
lines changed

4 files changed

+28
-63
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ programs/eosioc/eosioc
4949
programs/launcher/launcher
5050
programs/eosio-abigen/eosio-abigen
5151

52+
scripts/tn_init.sh
53+
5254
tests/app_test
5355
tests/chain_bench
5456
tests/chain_test

scripts/eosio-tn_down.sh

+8-46
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,20 @@ if [ "$PWD" != "$EOSIO_HOME" ]; then
1010
exit -1
1111
fi
1212

13-
prog=""
14-
RD=""
15-
for p in eosd eosiod nodeos; do
16-
prog=$p
17-
RD=bin
18-
if [ -f $RD/$prog ]; then
19-
break;
20-
else
21-
RD=programs/$prog
22-
if [ -f $RD/$prog ]; then
23-
break;
24-
fi
25-
fi
26-
prog=""
27-
RD=""
28-
done
29-
30-
if [ \( -z "$prog" \) -o \( -z "RD" \) ]; then
31-
echo unable to locate binary for eosd or eosiod or nodeos
32-
exit 1
33-
fi
13+
prog=nodeos
3414

35-
if [ -z "$EOSIO_TN_RESTART_DATA_DIR" ]; then
36-
echo data directory not set
37-
exit 1
38-
fi
39-
40-
DD=$EOSIO_TN_RESTART_DATA_DIR;
41-
runtest=""
42-
if [ $DD = "all" ]; then
43-
runtest=$prog
44-
else
45-
runtest=`cat $DD/$prog.pid`
46-
fi
47-
echo runtest = $runtest
15+
DD=var/lib/node_$EOSIO_NODE
16+
runtest=`cat $DD/$prog.pid`
17+
echo runtest = $runtest
4818
running=`ps -e | grep $runtest | grep -cv grep `
4919

5020
if [ $running -ne 0 ]; then
5121
echo killing $prog
5222

53-
if [ $runtest = $prog ]; then
54-
pkill -15 $runtest
55-
else
56-
kill -15 $runtest
57-
fi
23+
pkill -15 $prog
5824

59-
for (( a = 10; $a; a = $(($a - 1)) )); do
60-
echo waiting for safe termination, pass $((11 - $a))
25+
for (( a = 1;11-$a; a = $(($a + 1)) )); do
26+
echo waiting for safe termination, pass $a
6127
sleep 2
6228
running=`ps -e | grep $runtest | grep -cv grep`
6329
echo running = $running
@@ -69,9 +35,5 @@ fi
6935

7036
if [ $running -ne 0 ]; then
7137
echo killing $prog with SIGTERM failed, trying with SIGKILL
72-
if [ $runtest = $prog ]; then
73-
pkill -9 $runtest
74-
else
75-
kill -9 $runtest
76-
fi
38+
pkill -9 $runtest
7739
fi

scripts/eosio-tn_up.sh

+15-14
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,39 @@ if [ -z "$EOSIO_NODE" ]; then
2525
exit -1
2626
fi
2727

28+
datadir=var/lib/node_$EOSIO_NODE
29+
now=`date +'%Y_%m_%d_%H_%M_%S'`
30+
log=stderr.$now.txt
31+
touch $datadir/$log
32+
rm $datadir/stderr.txt
33+
ln -s $log $datadir/stderr.txt
34+
2835
relaunch() {
29-
nohup $rundir/$prog $* --data-dir $datadir --config-dir etc/eosio/node_$EOSIO_NODE > $datadir/stdout.txt 2>> $log &
36+
echo "$rundir/$prog $* --data-dir $datadir --config-dir etc/eosio/node_$EOSIO_NODE > $datadir/stdout.txt 2>> $datadir/$log "
37+
nohup $rundir/$prog $* --data-dir $datadir --config-dir etc/eosio/node_$EOSIO_NODE > $datadir/stdout.txt 2>> $datadir/$log &
3038
pid=$!
31-
39+
echo pid = $pid
3240
echo $pid > $datadir/$prog.pid
3341

3442
for (( a = 10; $a; a = $(($a - 1)) )); do
3543
echo checking viability pass $((11 - $a))
3644
sleep 2
37-
running=`ps -hp $pid`
45+
running=$(pgrep $prog | grep -c $pid)
46+
echo running = $running
3847
if [ -z "$running" ]; then
3948
break;
4049
fi
41-
connected=`grep -c "net_plugin.cpp:.*connection" $log`
50+
connected=`grep -c "net_plugin.cpp:.*connection" $datadir/$log`
4251
if [ "$connected" -ne 0 ]; then
4352
break;
4453
fi
4554
done
4655
}
4756

48-
datadir=var/lib/node_$EOSIO_NODE
49-
now=`date +'%Y_%m_%d_%H_%M_%S'`
50-
log=stderr.$now.txt
51-
touch $datadir/$log
52-
rm $datadir/stderr.txt
53-
ln -s $log $datadir/stderr.txt
54-
55-
5657
if [ -z "$EOSIO_LEVEL" ]; then
5758
echo starting with no modifiers
5859
relaunch $prog $rundir $*
59-
if [ \( -z "$running" \) -o \( "$connected" -eq 0 \) ]; then
60+
if [ "$connected" -eq 0 ]; then
6061
EOSIO_LEVEL=replay
6162
else
6263
exit 0
@@ -66,7 +67,7 @@ fi
6667
if [ "$EOSIO_LEVEL" == replay ]; then
6768
echo starting with replay
6869
relaunch $prog $rundir $* --replay
69-
if [ \( -z "$running" \) -o \( "$connected" -eq 0 \) ]; then
70+
if [ "$connected" -eq 0 ]; then
7071
EOSIO_LEVEL=resync
7172
else
7273
exit 0

testnet.template

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ wcmd create -n ignition
8585
###INSERT cacmd
8686

8787

88-
ecmd set contract eosio contracts/eosio.bios/eosio.bios.wast contracts/eosio.bios/eosio.bios.abi
88+
ecmd set contract eosio contracts/eosio.bios contracts/eosio.bios/eosio.bios.wast contracts/eosio.bios/eosio.bios.abi
8989

9090
#the setprods.json argument cannot pass through the function call due to embedded quotes
9191
echo ===== Start: $step ============ >> $logfile
@@ -95,7 +95,7 @@ programs/cleos/cleos --wallet-port $wdport --wallet-host $wdhost -p $biosport -H
9595
echo ==== End: $step ============== >> $logfile
9696
step=$(($step + 1))
9797

98-
ecmd set contract eosio contracts/eosio.system/eosio.system.wast contracts/eosio.system/eosio.system.abi
98+
ecmd set contract eosio contracts/eosio.system contracts/eosio.system/eosio.system.wast contracts/eosio.system/eosio.system.abi
9999

100100
echo ===== Start: $step ============ >> $logfile
101101
echo executing: cleos --wallet-port $wdport -p $biosport -H $bioshost push action eosio issue '{"to":"eosio","quantity":"1000000000.0000 EOS","memo":"init"}' -p eosio@active | tee -a $logfile
@@ -104,6 +104,6 @@ programs/cleos/cleos --wallet-port $wdport --wallet-host $wdhost -p $biosport -H
104104
echo ==== End: $step ============== >> $logfile
105105
step=$(($step + 1))
106106

107-
for a in {a..u}; do ecmd transfer eosio init$a 1000000.0000 "\"fund producer init$a\""; done
107+
for a in {a..u}; do ecmd transfer eosio init$a 1000000.0000 "\"fund_producer_init$a\""; done
108108

109109
pkill -15 keosd

0 commit comments

Comments
 (0)