9 abcicli "github.com/tendermint/abci/client"
10 "github.com/tendermint/abci/types"
11 "github.com/tendermint/tmlibs/log"
12 "github.com/tendermint/tmlibs/process"
15 func startApp(abciApp string) *process.Process {
17 //outBuf := NewBufferCloser(nil)
18 proc, err := process.StartProcess("abci_app",
21 []string{"-c", abciApp},
26 panic("running abci_app: " + err.Error())
29 // TODO a better way to handle this?
30 time.Sleep(time.Second)
35 func startClient(abciType string) abcicli.Client {
37 client, err := abcicli.NewClient("tcp://127.0.0.1:46658", abciType, true)
41 logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
42 client.SetLogger(logger.With("module", "abcicli"))
43 if _, err := client.Start(); err != nil {
44 panic("connecting to abci_app: " + err.Error())
50 func setOption(client abcicli.Client, key, value string) {
51 res := client.SetOptionSync(key, value)
52 _, _, log := res.Code, res.Data, res.Log
54 panic(fmt.Sprintf("setting %v=%v: \nlog: %v", key, value, log))
58 func commit(client abcicli.Client, hashExp []byte) {
59 res := client.CommitSync()
60 _, data, _ := res.Code, res.Data, res.Log
62 panic(fmt.Sprintf("committing err %v\n", res))
64 if !bytes.Equal(res.Data, hashExp) {
65 panic(fmt.Sprintf("Commit hash was unexpected. Got %X expected %X",
70 func deliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
71 res := client.DeliverTxSync(txBytes)
72 code, data, log := res.Code, res.Data, res.Log
74 panic(fmt.Sprintf("DeliverTx response code was unexpected. Got %v expected %v. Log: %v",
77 if !bytes.Equal(data, dataExp) {
78 panic(fmt.Sprintf("DeliverTx response data was unexpected. Got %X expected %X",
83 /*func checkTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
84 res := client.CheckTxSync(txBytes)
85 code, data, log := res.Code, res.Data, res.Log
87 panic(fmt.Sprintf("checking tx %X: %v\nlog: %v", txBytes, log))
90 panic(fmt.Sprintf("CheckTx response code was unexpected. Got %v expected %v. Log: %v",
93 if !bytes.Equal(data, dataExp) {
94 panic(fmt.Sprintf("CheckTx response data was unexpected. Got %X expected %X",