Commit 9534e195 authored by mdj33's avatar mdj33 Committed by vipwzw

cp system rpc from chain33

parent 2d22e8bc
......@@ -23,6 +23,7 @@ build/guodun
build/main.sh
build/main*
build/para.sh
build/system-test-rpc.sh
build/ci
build/autotest/*
!build/autotest/build.sh
......
......@@ -25,12 +25,12 @@ default: build depends
build:
@go build $(BUILD_FLAGS) -v -i -o $(APP)
@go build -v -i -o $(CLI) $(SRC_CLI)
@cp chain33.toml build/
@cp chain33.toml $(CHAIN33_PATH)/build/system-test-rpc.sh build/
build_ci: depends ## Build the binary file for CI
@go build -v -i -o $(CLI) $(SRC_CLI)
@go build $(BUILD_FLAGS) -v -o $(APP)
@cp chain33.toml build/
@cp chain33.toml $(CHAIN33_PATH)/build/system-test-rpc.sh build/
para:
@go build -v -o build/$(NAME) -ldflags "-X $(SRC_CLI)/buildflags.ParaName=user.p.$(NAME). -X $(SRC_CLI)/buildflags.RPCAddr=http://localhost:8901" $(SRC_CLI)
......@@ -142,6 +142,7 @@ clean: ## Remove previous build
@rm -rf build/logs
@rm -rf build/autotest/autotest
@rm -rf build/ci
@rm -rf build/system-rpc-test.sh
@rm -rf tool
@go clean
......
......@@ -333,15 +333,15 @@ function base_config() {
# transfer "${CLI4}"
}
function base_test() {
function rpc_test() {
if [ "$DAPP" == "" ]; then
system_test_rpc "http://${1}:8801"
dapp_test_rpc "http://${1}:8801"
fi
if [ "$DAPP" == "paracross" ]; then
system_test_rpc "http://${1}:8901"
dapp_test_rpc "http://${1}:8901"
fi
# if [ "$DAPP" == "paracross" ]; then
# system_test_rpc "http://${1}:8901"
# dapp_test_rpc "http://${1}:8901"
# fi
}
function dapp_run() {
......@@ -365,9 +365,11 @@ function main() {
### test cases ###
ip=$(${CLI} net info | jq -r ".externalAddr[0:10]")
base_test "${ip}"
dapp_run test "${ip}"
### rpc test ###
rpc_test "${ip}"
### finish ###
check_docker_container
echo "===============================DAPP=$DAPP main end========================================================="
......
......@@ -2,16 +2,19 @@
# shellcheck disable=SC2128
MAIN_HTTP=""
PARA_HTTP=""
CASE_ERR=""
UNIT_HTTP=""
#color
RED='\033[1;31m'
GRE='\033[1;32m'
NOC='\033[0m'
# $2=0 means true, other false
echo_rst() {
if [ "$2" -eq 0 ]; then
echo "$1 ok"
echo -e "${GRE}$1 ok${NOC}"
else
echo "$1 err"
echo -e "${RED}$1 fail${NOC}"
CASE_ERR="err"
fi
......@@ -65,11 +68,12 @@ Chain33_SendToAddress() {
req='"method":"Chain33.SendToAddress", "params":[{"from":"'"$from"'","to":"'"$to"'", "amount":'"$amount"', "note":"test\n"}]'
# echo "#request: $req"
resp=$(curl -ksd "{$req}" "${MAIN_HTTP}")
echo "#response: $resp"
# echo "#response: $resp"
ok=$(jq '(.error|not) and (.result.hash|length==66)' <<<"$resp")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
# hash=$(jq '(.result.hash)' <<<"$resp")
hash=$(jq '(.result.hash)' <<<"$resp")
echo "hash=$hash"
# query_tx "$hash"
}
......@@ -97,7 +101,7 @@ sendTx() {
err=$(jq '(.error)' <<<"$resp")
txhash=$(jq -r ".result" <<<"$resp")
if [ "$err" == null ]; then
echo "tx hash: $txhash"
# echo "tx hash: $txhash"
query_tx "$txhash"
else
echo "send tx error:$err"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment