Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
fb49d408
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fb49d408
编写于
11月 13, 2017
作者:
K
Kevin Heifner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merge QA test script with original script #686
上级
4571ea3d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
101 addition
and
38 deletion
+101
-38
.travis.yml
.travis.yml
+1
-1
tests/eosd_run_test.sh
tests/eosd_run_test.sh
+100
-37
未找到文件。
.travis.yml
浏览文件 @
fb49d408
...
...
@@ -75,7 +75,7 @@ script:
-
mkdir build && cd build
-
${CMAKE_DIR}cmake -G Ninja -DWASM_LLVM_CONFIG=$TRAVIS_BUILD_DIR/ext/wasm-compiler/bin/llvm-config -DSecp256k1_ROOT_DIR=$TRAVIS_BUILD_DIR/ext -DBINARYEN_ROOT=$TRAVIS_BUILD_DIR/ext/wasm-compiler -DCMAKE_PREFIX_PATH=$TRAVIS_BUILD_DIR/ext -DCMAKE_BUILD_TYPE=Release $EOS_CMAKE_OPTIONS ..
-
ninja -j4
-
tests/eosd_run_test.sh
-
tests/eosd_run_test.sh
--host=localhost --port=8888
-
'
[
"$TRAVIS_OS_NAME"
==
"osx"
]
||
tests/chain_test'
-
'
[
"$TRAVIS_OS_NAME"
==
"osx"
]
||
tests/slow_test'
-
tests/api_test
...
...
tests/eosd_run_test.sh
浏览文件 @
fb49d408
...
...
@@ -3,6 +3,36 @@
# prevent bc from adding \ at end of large hex values
export
BC_LINE_LENGTH
=
9999
TEST_OUTPUT
=
"test_output_0.txt"
if
[
$#
-lt
2
]
;
then
echo
"usage: eosd_run_test.sh --host=host_name --port=port --output=test_output_0.txt"
echo
" If --host==localhost then this script also launches an eosd for the test."
echo
" Example: eosd_run_test_sh --host=localhost --port=8888 --output=test_output_0.txt"
exit
1
fi
for
i
in
"
$@
"
do
case
$i
in
-o
*
|
--output
=
*
)
TEST_OUTPUT
=
"
${
i
#*=
}
"
shift
;;
-h
*
|
--host
=
*
)
SERVER
=
"
${
i
#*=
}
"
shift
;;
-p
*
|
--port
=
*
)
PORT
=
"
${
i
#*=
}
"
shift
;;
*
)
;;
esac
done
# $1 - error message
error
()
{
...
...
@@ -17,6 +47,8 @@ error()
echo
=================================================================
echo
Contents of test_walletd_output.log:
cat
test_walletd_output.log
echo
=================================================================
echo
==
Errors see above
==
exit
1
}
...
...
@@ -30,7 +62,9 @@ verifyErrorCode()
killAll
()
{
programs/launcher/launcher
-k
9
if
[
"
$SERVER
"
==
"localhost"
]
;
then
programs/launcher/launcher
-k
9
fi
kill
-9
$WALLETD_PROC_ID
}
...
...
@@ -53,7 +87,7 @@ getTransactionId()
# result stored in HEAD_BLOCK_NUM
getHeadBlockNum()
{
INFO="
$(
programs/eosc/eosc get info
)
"
INFO="
$(
programs/eosc/eosc
--host
$SERVER
--port
$PORT
get info
)
"
verifyErrorCode "
eosc
get info
"
HEAD_BLOCK_NUM="
$(
echo
"
$INFO
"
|
awk
'/head_block_num/ {print $2}'
)
"
# remove trailing coma
...
...
@@ -73,17 +107,24 @@ waitForNextBlock()
# cleanup from last run
cleanup
echo "
BEGIN
" >
$TEST_OUTPUT
echo "
TEST_OUTPUT
:
${
TEST_OUTPUT
}
"
echo "
SERVER
:
${
SERVER
}
"
echo "
PORT
:
${
PORT
}
"
INITA_PRV_KEY="
5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
"
INITB_PRV_KEY="
5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
"
LOG_FILE=eosd_run_test.log
# eosd
programs/launcher/launcher
verifyErrorCode "
launcher
"
sleep 7
count=
`
grep
-c
"generated block"
tn_data_0/stderr.txt
`
if [[
$count
== 0 ]]; then
error "
FAILURE
- no blocks produced
"
if [ "
$SERVER
" == "
localhost
" ]; then
programs/launcher/launcher
verifyErrorCode "
launcher
"
sleep 7
count=
`
grep
-c
"generated block"
tn_data_0/stderr.txt
`
if [[
$count
== 0 ]]; then
error "
FAILURE
- no blocks produced
"
fi
fi
# save starting block number
...
...
@@ -197,12 +238,12 @@ fi
#
# create new account
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 create account inita testera
$PUB_KEY1
$PUB_KEY3
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 create account inita testera
$PUB_KEY1
$PUB_KEY3
)
"
verifyErrorCode "
eosc
create account
"
waitForNextBlock
# verify account created
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get account testera
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get account testera
)
"
verifyErrorCode "
eosc
get account
"
count=
`
echo
$ACCOUNT_INFO
|
grep
-c
"staked_balance"
`
if [
$count
== 0 ]; then
...
...
@@ -210,18 +251,30 @@ if [ $count == 0 ]; then
fi
# transfer
TRANSFER_INFO="
$(
programs/eosc/eosc
--
wallet-port
8899 transfer inita testera 975321
"test transfer"
)
"
TRANSFER_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--wallet-port
8899 transfer inita testera 975321
"test transfer"
)
-x 3000
"
verifyErrorCode "
eosc
transfer
"
# verify transfer
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get account testera
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get account testera
)
"
count=
`
echo
$ACCOUNT_INFO
|
grep
-c
"97.5321"
`
if [
$count
== 0 ]; then
error "
FAILURE
- transfer failed
:
$ACCOUNT_INFO
"
fi
# force transfer
TRANSFER_INFO="
$(
programs/eosc/eosc
--host
$SERVER
--port
$PORT
--wallet-port
8899 transfer inita testera 100
"test transfer"
-f
)
-x 3000
"
verifyErrorCode "
eosc
force transfer
"
# verify force transfer
ACCOUNT_INFO="
$(
programs/eosc/eosc
--host
$SERVER
--port
$PORT
--wallet-port
8899 get account testera
)
"
count=
`
echo
$ACCOUNT_INFO
|
grep
-c
"97.5421"
`
if [
$count
== 0 ]; then
error "
FAILURE
- transfer failed
:
$ACCOUNT_INFO
"
fi
# create another new account via initb
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 create account initb currency
$PUB_KEY2
$PUB_KEY3
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 create account initb currency
$PUB_KEY2
$PUB_KEY3
)
"
verifyErrorCode "
eosc
create account
"
waitForNextBlock
...
...
@@ -236,13 +289,13 @@ echo $PASSWORD | programs/eosc/eosc --wallet-port 8899 wallet unlock --name test
verifyErrorCode "
eosc
wallet unlock
"
# transfer
TRANSFER_INFO="
$(
programs/eosc/eosc
--
wallet-port
8899 transfer testera currency 975311
"test transfer a->b"
)
"
TRANSFER_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--wallet-port
8899 transfer testera currency 975311
"test transfer a->b"
)
-x 3000
"
verifyErrorCode "
eosc
transfer
"
waitForNextBlock
getTransactionId "
$TRANSFER_INFO
"
# verify transfer
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get account currency
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get account currency
)
"
verifyErrorCode "
eosc
get account currency
"
count=
`
echo
$ACCOUNT_INFO
|
grep
-c
"97.5311"
`
if [
$count
== 0 ]; then
...
...
@@ -250,7 +303,7 @@ if [ $count == 0 ]; then
fi
# get accounts via public key
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get accounts
$PUB_KEY3
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get accounts
$PUB_KEY3
)
"
verifyErrorCode "
eosc
get accounts pub_key3
"
count=
`
echo
$ACCOUNT_INFO
|
grep
-c
"testera"
`
if [
$count
== 0 ]; then
...
...
@@ -260,7 +313,7 @@ count=`echo $ACCOUNT_INFO | grep -c "currency"`
if [
$count
== 0 ]; then
error "
FAILURE
- get accounts failed
:
$ACCOUNT_INFO
"
fi
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get accounts
$PUB_KEY1
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get accounts
$PUB_KEY1
)
"
verifyErrorCode "
eosc
get accounts pub_key1
"
count=
`
echo
$ACCOUNT_INFO
|
grep
-c
"testera"
`
if [
$count
== 0 ]; then
...
...
@@ -272,7 +325,7 @@ if [ $count != 0 ]; then
fi
# get servant accounts
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get servants inita
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get servants inita
)
"
verifyErrorCode "
eosc
get servants inita
"
count=
`
echo
$ACCOUNT_INFO
|
grep
-c
"testera"
`
if [
$count
== 0 ]; then
...
...
@@ -282,7 +335,7 @@ count=`echo $ACCOUNT_INFO | grep -c "currency"`
if [
$count
!= 0 ]; then
error "
FAILURE
- get servants failed
:
$ACCOUNT_INFO
"
fi
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get servants testera
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get servants testera
)
"
verifyErrorCode "
eosc
get servants testera
"
count=
`
echo
$ACCOUNT_INFO
|
grep
-c
"testera"
`
if [
$count
!= 0 ]; then
...
...
@@ -290,7 +343,7 @@ if [ $count != 0 ]; then
fi
# get transaction
TRANS_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get transaction
$TRANS_ID
)
"
TRANS_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get transaction
$TRANS_ID
)
"
verifyErrorCode "
eosc
get transaction trans_id of
$TRANS_INFO
"
count=
`
echo
$TRANS_INFO
|
grep
-c
"transfer"
`
if [
$count
== 0 ]; then
...
...
@@ -302,7 +355,7 @@ if [ $count == 0 ]; then
fi
# get transactions
TRANS_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get transactions testera
)
"
TRANS_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get transactions testera
)
"
verifyErrorCode "
eosc
get transactions testera
"
count=
`
echo
$TRANS_INFO
|
grep
-c
"
$TRANS_ID
"
`
if [
$count
== 0 ]; then
...
...
@@ -314,7 +367,7 @@ fi
#
# verify no contract in place
CODE_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get code currency
)
"
CODE_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get code currency
)
"
verifyErrorCode "
eosc
get code currency
"
# convert to num
CODE_HASH="
$(
echo
"
$CODE_INFO
"
|
awk
'/code hash/ {print $3}'
)
"
...
...
@@ -325,7 +378,7 @@ if [ $CODE_HASH != 0 ]; then
fi
# upload a contract
INFO="
$(
programs/eosc/eosc
--wallet-port
8899
set
contract currency contracts/currency/currency.wast contracts/currency/currency.abi
)
"
INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899
set
contract currency contracts/currency/currency.wast contracts/currency/currency.abi
)
"
verifyErrorCode "
eosc
set contract testera
"
count=
`
echo
$INFO
|
grep
-c
"processed"
`
if [
$count
== 0 ]; then
...
...
@@ -335,11 +388,11 @@ getTransactionId "$INFO"
waitForNextBlock
# verify transaction exists
TRANS_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get transaction
$TRANS_ID
)
"
TRANS_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get transaction
$TRANS_ID
)
"
verifyErrorCode "
eosc
get transaction trans_id of
$TRANS_INFO
"
# verify code is set
CODE_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get code currency
)
"
CODE_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get code currency
)
"
verifyErrorCode "
eosc
get code currency
"
# convert to num
CODE_HASH="
$(
echo
"
$CODE_INFO
"
|
awk
'/code hash/ {print $3}'
)
"
...
...
@@ -350,7 +403,7 @@ if [ $CODE_HASH == 0 ]; then
fi
# verify currency contract has proper initial balance
INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get table currency currency account
)
"
INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get table currency currency account
)
"
verifyErrorCode "
eosc
get table currency account
"
count=
`
echo
$INFO
|
grep
-c
"1000000000"
`
if [
$count
== 0 ]; then
...
...
@@ -358,24 +411,24 @@ if [ $count == 0 ]; then
fi
# push message to currency contract
INFO="
$(
programs/eosc/eosc
--wallet-port
8899 push message currency transfer
'{"from":"currency","to":"inita","amount":50}'
--scope
currency,inita
--permission
currency@active
)
"
INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 push message currency transfer
'{"from":"currency","to":"inita","amount":50}'
--scope
currency,inita
--permission
currency@active
)
"
verifyErrorCode "
eosc
push message currency transfer
"
getTransactionId "
$INFO
"
# verify transaction exists
waitForNextBlock
TRANS_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get transaction
$TRANS_ID
)
"
TRANS_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get transaction
$TRANS_ID
)
"
verifyErrorCode "
eosc
get transaction trans_id of
$TRANS_INFO
"
# read current contract balance
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get table inita currency account
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get table inita currency account
)
"
verifyErrorCode "
eosc
get table currency account
"
count=
`
echo
$ACCOUNT_INFO
|
grep
"balance"
|
grep
-c
"50"
`
if [
$count
== 0 ]; then
error "
FAILURE
- get table inita account failed
:
$ACCOUNT_INFO
"
fi
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get table currency currency account
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get table currency currency account
)
"
verifyErrorCode "
eosc
get table currency account
"
count=
`
echo
$ACCOUNT_INFO
|
grep
"balance"
|
grep
-c
"999999950"
`
if [
$count
== 0 ]; then
...
...
@@ -386,27 +439,35 @@ fi
# Producer
#
INFO="
$(
programs/eosc/eosc
--wallet-port
8899 create producer testera
$PUB_KEY1
)
"
INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 create producer testera
$PUB_KEY1
)
"
verifyErrorCode "
eosc
create producer
"
getTransactionId "
$INFO
"
# set permission
#INFO="
$(
programs/eosc/eosc
--host
$SERVER
--port
$PORT
set
action permission testera currency transfer active
)
"
#verifyErrorCode "
eosc
set action permission set
"
# remove permission
#INFO="
$(
programs/eosc/eosc
--host
$SERVER
--port
$PORT
set
action permission testera currency transfer
)
"
#verifyErrorCode "
eosc
set action permission delete
"
# lock via lock_all
programs/eosc/eosc --wallet-port 8899 wallet lock_all
programs/eosc/eosc --
host
$SERVER
--port
$PORT
--
wallet-port 8899 wallet lock_all
verifyErrorCode "
eosc
wallet lock_all
"
# unlock wallet inita
echo
$PASSWORD_INITA
| programs/eosc/eosc --wallet-port 8899 wallet unlock --name inita
echo
$PASSWORD_INITA
| programs/eosc/eosc --
host
$SERVER
--port
$PORT
--
wallet-port 8899 wallet unlock --name inita
verifyErrorCode "
eosc
wallet unlock inita
"
# approve producer
INFO="
$(
programs/eosc/eosc
--wallet-port
8899
set
producer inita testera approve
)
"
INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899
set
producer inita testera approve
)
"
verifyErrorCode "
eosc
approve producer
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--wallet-port
8899 get account inita
)
"
ACCOUNT_INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899 get account inita
)
"
verifyErrorCode "
eosc
get account
"
# unapprove producer
INFO="
$(
programs/eosc/eosc
--wallet-port
8899
set
producer inita testera unapprove
)
"
INFO="
$(
programs/eosc/eosc
--
host
$SERVER
--port
$PORT
--
wallet-port
8899
set
producer inita testera unapprove
)
"
verifyErrorCode "
eosc
unapprove producer
"
#
...
...
@@ -419,11 +480,13 @@ getHeadBlockNum
CURRENT_BLOCK_NUM=
$HEAD_BLOCK_NUM
NEXT_BLOCK_NUM=1
while [ "
$NEXT_BLOCK_NUM
" -le "
$HEAD_BLOCK_NUM
" ]; do
INFO="
$(
programs/eosc/eosc get block
$NEXT_BLOCK_NUM
)
"
INFO="
$(
programs/eosc/eosc
--host
$SERVER
--port
$PORT
get block
$NEXT_BLOCK_NUM
)
"
verifyErrorCode "
eosc
get block
"
NEXT_BLOCK_NUM=
$((
NEXT_BLOCK_NUM+1
))
done
killAll
cleanup
echo "
END
" >>
$TEST_OUTPUT
echo SUCCESS!
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录