Skip to content

Commit

Permalink
towards unit tests in engine
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSnow committed Apr 23, 2017
1 parent f558c2b commit 358cd54
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions engine/NetStart.go
Expand Up @@ -42,7 +42,7 @@ var p2pProxy *P2PProxy
var p2pNetwork *p2p.Controller
var logPort string

func NetStart(s *state.State) {
func NetStart(s *state.State, args []string) {
ackBalanceHashPtr := flag.Bool("balancehash", true, "If false, then don't pass around balance hashes")
enablenetPtr := flag.Bool("enablenet", true, "Enable or disable networking")
waitEntriesPtr := flag.Bool("waitentries", false, "Wait for Entries to be validated prior to execution of messages")
Expand Down Expand Up @@ -81,7 +81,7 @@ func NetStart(s *state.State) {
factomdLocationsflag := flag.String("selfaddr", "", "comma seperated IPAddresses and DNS names of this factomd to use when creating a cert file")
memProfileRate := flag.Int("mpr", 512*1024, "Set the Memory Profile Rate to update profiling per X bytes allocated. Default 512K, set to 1 to profile everything, 0 to disable.")

flag.Parse()
flag.CommandLine.Parse(args)

ackbalanceHash := *ackBalanceHashPtr
enableNet := *enablenetPtr
Expand Down
4 changes: 2 additions & 2 deletions engine/factomd.go
Expand Up @@ -28,7 +28,7 @@ var _ = fmt.Print
// Since we are tracking code changes, then there is no need to delete the binary to use the latest message
var Build string

func Factomd() {
func Factomd(args []string) {
log.Print("//////////////////////// Copyright 2017 Factom Foundation")
log.Print("//////////////////////// Use of this source code is governed by the MIT")
log.Print("//////////////////////// license that can be found in the LICENSE file.")
Expand All @@ -50,7 +50,7 @@ func Factomd() {
state0.SetLeaderTimestamp(primitives.NewTimestampFromMilliseconds(0))
fmt.Println("len(Args)", len(os.Args))

NetStart(state0)
NetStart(state0,args)
}

func isCompilerVersionOK() bool {
Expand Down
3 changes: 2 additions & 1 deletion factomd.go
Expand Up @@ -6,9 +6,10 @@ package main

import (
"github.com/FactomProject/factomd/engine"
"os"
)

func main() {
// uncomment StartProfiler() to run the pprof tool (for testing)
engine.Factomd()
engine.Factomd(os.Args[1:])
}
4 changes: 2 additions & 2 deletions scripts/entryloadm2.sh
Expand Up @@ -33,7 +33,7 @@ addentries() {
echo "Entry Length " $datalen " bytes, file name: " $datafile

for ((i=0; i<nentries; i++)); do
cat $datafile | factom-cli -s=$factomd addentry -f -c $1 -e test -e $i -e $RANDOM -e $RANDOM -e $RANDOM $ec1
cat $datafile | factom-cli -s=$factomd addentry -c $1 -e test -e $i -e $RANDOM -e $RANDOM -e $RANDOM $ec1
echo "write entry Chain:" $2 $i
sleep 5.2s
done
Expand All @@ -46,7 +46,7 @@ echo "Start"

for ((i=0; i<nchains; i++)); do
echo "create chain" $i
chainid=$(echo test $i $RANDOM | factom-cli -s=$factomd addchain -f -n test -n $i -n $RANDOM $ec1 | awk '/ChainID/{print $2}')
chainid=$(echo test $i $RANDOM | factom-cli -s=$factomd addchain -n test -n $i -n $RANDOM $ec1 | awk '/ChainID/{print $2}')
addentries $chainid $i &
sleep 10
done
Expand Down
10 changes: 5 additions & 5 deletions scripts/multifactoidtrans.sh
Expand Up @@ -30,35 +30,35 @@ factom-cli addtxinput -q t1 $big .001
factom-cli addtxoutput -q t1 $fct2 .001
factom-cli addtxfee -q t1 $big
factom-cli signtx -q t1
factom-cli sendtx -q -f t1
factom-cli sendtx -q t1

factom-cli newtx -q t1
factom-cli addtxinput -q t1 $big .001
factom-cli addtxoutput -q t1 $fct3 .001
factom-cli addtxfee -q t1 $big
factom-cli signtx -q t1
factom-cli sendtx -q -f t1
factom-cli sendtx -q t1

factom-cli newtx -q t1
factom-cli addtxinput -q t1 $big .001
factom-cli addtxoutput -q t1 $fct4 .001
factom-cli addtxfee -q t1 $big
factom-cli signtx -q t1
factom-cli sendtx -q -f t1
factom-cli sendtx -q t1

factom-cli newtx -q t1
factom-cli addtxinput -q t1 $big .001
factom-cli addtxoutput -q t1 $fct5 .001
factom-cli addtxfee -q t1 $big
factom-cli signtx -q t1
factom-cli sendtx -q -f t1
factom-cli sendtx -q t1

factom-cli newtx -q t1
factom-cli addtxinput -q t1 $big .001
factom-cli addtxoutput -q t1 $fct6 .001
factom-cli addtxfee -q t1 $big
factom-cli signtx -q t1
factom-cli sendtx -q -f t1
factom-cli sendtx -q t1

sleep .8

Expand Down

0 comments on commit 358cd54

Please sign in to comment.