Merge pull request #129 from harmony-one/HAR-99_support_beacon_test_in_local

HAR-99: support beacon test in local
pull/119/head
Leo Chen 6 years ago committed by GitHub
commit 4076311d19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .gitignore
  2. 11
      deploy.sh
  3. 1
      go_executable_build.sh
  4. 4
      kill_node.sh
  5. 12
      local_config1.txt
  6. 22
      runbeacon/run-beacon.go

3
.gitignore vendored

@ -31,3 +31,6 @@ keystore
# Cscope files # Cscope files
cscope.* cscope.*
# local runtime logs
tmp_log

@ -61,6 +61,7 @@ fi
# Also it's recommended to use `go build` for testing the whole exe. # Also it's recommended to use `go build` for testing the whole exe.
go build -o bin/benchmark go build -o bin/benchmark
go build -o bin/txgen client/txgen/main.go go build -o bin/txgen client/txgen/main.go
go build -o bin/beacon runbeacon/run-beacon.go
# Create a tmp folder for logs # Create a tmp folder for logs
t=`date +"%Y%m%d-%H%M%S"` t=`date +"%Y%m%d-%H%M%S"`
@ -68,6 +69,11 @@ log_folder="tmp_log/log-$t"
mkdir -p $log_folder mkdir -p $log_folder
if [ -n "$PEER" ]; then
./bin/beacon > $log_folder/beacon.log 2>&1 &
sleep 1 #wait or beachchain up
fi
# Start nodes # Start nodes
while IFS='' read -r line || [[ -n "$line" ]]; do while IFS='' read -r line || [[ -n "$line" ]]; do
IFS=' ' read ip port mode shardID <<< $line IFS=' ' read ip port mode shardID <<< $line
@ -77,7 +83,7 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
./bin/benchmark -ip $ip -port $port -config_file $config -log_folder $log_folder $DB -min_peers $MIN & ./bin/benchmark -ip $ip -port $port -config_file $config -log_folder $log_folder $DB -min_peers $MIN &
else else
./bin/benchmark -ip $ip -port $port -log_folder $log_folder $DB $PEER -min_peers $MIN & ./bin/benchmark -ip $ip -port $port -log_folder $log_folder $DB $PEER -min_peers $MIN &
sleep 5 sleep 1
fi fi
fi fi
done < $config done < $config
@ -85,3 +91,6 @@ done < $config
if [ "$TXGEN" == "true" ]; then if [ "$TXGEN" == "true" ]; then
./bin/txgen -config_file $config -log_folder $log_folder -duration $DURATION ./bin/txgen -config_file $config -log_folder $log_folder -duration $DURATION
fi fi
# Kill nodes if any
./kill_node.sh

@ -2,6 +2,7 @@
declare -A SRC declare -A SRC
SRC[benchmark]=benchmark.go SRC[benchmark]=benchmark.go
SRC[txgen]=client/txgen/main.go SRC[txgen]=client/txgen/main.go
SRC[beacon]=runbeacon/run-beacon.go
BINDIR=bin BINDIR=bin
BUCKET=unique-bucket-bin BUCKET=unique-bucket-bin

@ -1,4 +1,6 @@
for pid in `/bin/ps -fu $USER| grep "benchmark\|txgen\|soldier\|commander\|profiler" | grep -v "grep" | awk '{print $2}'`; #!/bin/bash
for pid in `/bin/ps -fu $USER| grep "benchmark\|txgen\|soldier\|commander\|profiler\|beacon" | grep -v "grep" | grep -v "vi" | awk '{print $2}'`;
do do
echo 'Killed process: '$pid echo 'Killed process: '$pid
kill -9 $pid kill -9 $pid

@ -0,0 +1,12 @@
127.0.0.1 9000 leader 0
127.0.0.1 9001 validator 0
127.0.0.1 9002 validator 0
127.0.0.1 9003 validator 0
127.0.0.1 9004 validator 0
127.0.0.1 9005 validator 0
127.0.0.1 9006 validator 0
127.0.0.1 9007 validator 0
127.0.0.1 9008 validator 0
127.0.0.1 9009 validator 0
127.0.0.1 9010 validator 0
127.0.0.1 9999 client 0

@ -2,15 +2,37 @@ package main
import ( import (
"flag" "flag"
"fmt"
"os"
"path"
"github.com/harmony-one/harmony/beaconchain" "github.com/harmony-one/harmony/beaconchain"
) )
var (
version string
builtBy string
builtAt string
commit string
)
func printVersion(me string) {
fmt.Fprintf(os.Stderr, "Harmony (C) 2018. %v, version %v-%v (%v %v)\n", path.Base(me), version, commit, builtBy, builtAt)
os.Exit(0)
}
func main() { func main() {
numShards := flag.Int("numShards", 1, "number of shards of identity chain") numShards := flag.Int("numShards", 1, "number of shards of identity chain")
ip := flag.String("ip", "127.0.0.1", "ip on which beaconchain listens") ip := flag.String("ip", "127.0.0.1", "ip on which beaconchain listens")
port := flag.String("port", "8081", "port on which beaconchain listens") port := flag.String("port", "8081", "port on which beaconchain listens")
versionFlag := flag.Bool("version", false, "Output version info")
flag.Parse() flag.Parse()
if *versionFlag {
printVersion(os.Args[0])
}
bc := beaconchain.New(*numShards, *ip, *port) bc := beaconchain.New(*numShards, *ip, *port)
bc.StartServer() bc.StartServer()
} }

Loading…
Cancel
Save