-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
90 lines (69 loc) · 1.59 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package main
import (
"flag"
"fmt"
"os"
_ "github.com/spacemeshos/go-spacemesh/common/types"
_ "github.com/spacemeshos/go-spacemesh/common/util"
)
const echoText = "test-ping-smtest"
var (
//Options
//Params
flagRPCURL = flag.String("rpcurl", "", "(param) rpc url")
//Debug
flagTestEcho = flag.Bool("test_echo", false, "(option) test echo")
flagTestNodeSync = flag.Bool("test_nodesync", false, "(option) node sync stream")
flagTestMeshLayer = flag.Bool("test_meshlayer", false, "(option) mesh layer stream")
flagTestGlobalTx = flag.Bool("test_globaltx", false, "(option) global transaction receipts")
flagTestGlobalRewards = flag.Bool("test_globalrewards", false, "(option) global rewards")
)
var rpcURL string
func main() {
flag.Parse()
if len(*flagRPCURL) == 0 {
fmt.Println("ERROR: -rpcurl is mandatory")
os.Exit(1)
}
rpcURL = *flagRPCURL
if *flagTestEcho {
v, err := testEcho(echoText)
if err != nil {
fmt.Printf("ERROR: %v\n", err)
}
if v == echoText {
fmt.Println("ECHO: OK")
} else {
fmt.Println("ERROR: echo mismatch")
}
os.Exit(1)
}
if *flagTestNodeSync {
err := testNodeSync()
if err != nil {
fmt.Printf("ERROR: %v\n", err)
}
os.Exit(1)
}
if *flagTestMeshLayer {
err := testMeshLayer()
if err != nil {
fmt.Printf("ERROR: %v\n", err)
}
os.Exit(1)
}
if *flagTestGlobalTx {
err := testGlobalTx()
if err != nil {
fmt.Printf("ERROR: %v\n", err)
}
os.Exit(1)
}
if *flagTestGlobalRewards {
err := testGlobalRewards()
if err != nil {
fmt.Printf("ERROR: %v\n", err)
}
os.Exit(1)
}
}