Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
53d1ce1e
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,发现更多精彩内容 >>
提交
53d1ce1e
编写于
5月 08, 2018
作者:
A
Anton Perkov
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'slim' into payment
上级
d374afbc
d67370a9
变更
11
展开全部
显示空白变更内容
内联
并排
Showing
11 changed file
with
369 addition
and
398 deletion
+369
-398
contracts/eosio.system/eosio.system.abi
contracts/eosio.system/eosio.system.abi
+2
-1
contracts/eosio.system/eosio.system.hpp
contracts/eosio.system/eosio.system.hpp
+2
-1
contracts/eosio.system/voting.cpp
contracts/eosio.system/voting.cpp
+2
-0
contracts/skeleton/skeleton.abi
contracts/skeleton/skeleton.abi
+0
-39
contracts/skeleton/skeleton.cpp
contracts/skeleton/skeleton.cpp
+12
-15
programs/cleos/main.cpp
programs/cleos/main.cpp
+63
-9
tests/CMakeLists.txt
tests/CMakeLists.txt
+1
-1
tests/nodeos_run_test.py
tests/nodeos_run_test.py
+28
-38
tests/testUtils.py
tests/testUtils.py
+257
-292
tools/ctestwrapper.sh
tools/ctestwrapper.sh
+1
-1
unittests/CMakeLists.txt
unittests/CMakeLists.txt
+1
-1
未找到文件。
contracts/eosio.system/eosio.system.abi
浏览文件 @
53d1ce1e
...
@@ -139,6 +139,7 @@
...
@@ -139,6 +139,7 @@
{"name":"owner", "type":"account_name"},
{"name":"owner", "type":"account_name"},
{"name":"total_votes", "type":"float64"},
{"name":"total_votes", "type":"float64"},
{"name":"producer_key", "type":"public_key"},
{"name":"producer_key", "type":"public_key"},
{"name":"url", "type":"string"},
{"name":"produced_blocks", "type":"uint32"},
{"name":"produced_blocks", "type":"uint32"},
{"name":"last_claim_time", "type":"uint64"},
{"name":"last_claim_time", "type":"uint64"},
{"name":"location", "type":"uint16"},
{"name":"location", "type":"uint16"},
...
@@ -255,7 +256,7 @@
...
@@ -255,7 +256,7 @@
}
}
],
],
"tables": [{
"tables": [{
"name": "producer
info
",
"name": "producer
s
",
"type": "producer_info",
"type": "producer_info",
"index_type": "i64",
"index_type": "i64",
"key_names" : ["owner"],
"key_names" : ["owner"],
...
...
contracts/eosio.system/eosio.system.hpp
浏览文件 @
53d1ce1e
...
@@ -50,6 +50,7 @@ namespace eosiosystem {
...
@@ -50,6 +50,7 @@ namespace eosiosystem {
account_name
owner
;
account_name
owner
;
double
total_votes
=
0
;
double
total_votes
=
0
;
eosio
::
public_key
producer_key
;
/// a packed public key object
eosio
::
public_key
producer_key
;
/// a packed public key object
std
::
string
url
;
uint32_t
produced_blocks
;
uint32_t
produced_blocks
;
uint64_t
last_claim_time
=
0
;
uint64_t
last_claim_time
=
0
;
uint16_t
location
=
0
;
uint16_t
location
=
0
;
...
@@ -61,7 +62,7 @@ namespace eosiosystem {
...
@@ -61,7 +62,7 @@ namespace eosiosystem {
bool
active
()
const
{
return
producer_key
!=
public_key
();
}
bool
active
()
const
{
return
producer_key
!=
public_key
();
}
// explicit serialization macro is not necessary, used here only to improve compilation time
// explicit serialization macro is not necessary, used here only to improve compilation time
EOSLIB_SERIALIZE
(
producer_info
,
(
owner
)(
total_votes
)(
producer_key
)
EOSLIB_SERIALIZE
(
producer_info
,
(
owner
)(
total_votes
)(
producer_key
)
(
url
)
(
produced_blocks
)(
last_claim_time
)(
location
)
(
produced_blocks
)(
last_claim_time
)(
location
)
(
time_became_active
)(
last_produced_block_time
)
)
(
time_became_active
)(
last_produced_block_time
)
)
};
};
...
...
contracts/eosio.system/voting.cpp
浏览文件 @
53d1ce1e
...
@@ -45,6 +45,7 @@ namespace eosiosystem {
...
@@ -45,6 +45,7 @@ namespace eosiosystem {
if
(
producer_key
!=
prod
->
producer_key
)
{
if
(
producer_key
!=
prod
->
producer_key
)
{
_producers
.
modify
(
prod
,
producer
,
[
&
](
producer_info
&
info
){
_producers
.
modify
(
prod
,
producer
,
[
&
](
producer_info
&
info
){
info
.
producer_key
=
producer_key
;
info
.
producer_key
=
producer_key
;
info
.
url
=
url
;
});
});
}
}
}
else
{
}
else
{
...
@@ -52,6 +53,7 @@ namespace eosiosystem {
...
@@ -52,6 +53,7 @@ namespace eosiosystem {
info
.
owner
=
producer
;
info
.
owner
=
producer
;
info
.
total_votes
=
0
;
info
.
total_votes
=
0
;
info
.
producer_key
=
producer_key
;
info
.
producer_key
=
producer_key
;
info
.
url
=
url
;
});
});
}
}
}
}
...
...
contracts/skeleton/skeleton.abi
已删除
100644 → 0
浏览文件 @
d374afbc
{
"types": [{
"new_type_name": "account_name",
"type": "name"
}
],
"structs": [{
"name": "transfer",
"base": "",
"fields": [
{"name":"from", "type":"account_name"},
{"name":"to", "type":"account_name"},
{"name":"amount", "type":"uint64"}
]
},{
"name": "account",
"base": "",
"fields": [
{"name":"account", "type":"name"},
{"name":"balance", "type":"uint64"}
]
}
],
"actions": [{
"name": "transfer",
"type": "transfer",
"ricardian_contract": ""
}
],
"tables": [{
"name": "account",
"type": "account",
"index_type": "i64",
"key_names" : ["account"],
"key_types" : ["name"]
}
],
"ricardian_clauses": []
}
contracts/skeleton/skeleton.cpp
浏览文件 @
53d1ce1e
/**
#include <eosiolib/eosio.hpp>
* @file
* @copyright defined in eos/LICENSE.txt
*/
#include <skeleton.hpp>
/**
using
namespace
eosio
;
* The init() and apply() methods must have C calling convention so that the blockchain can lookup and
* call these methods.
*/
extern
"C"
{
/// The apply method implements the dispatch of events to this contract
class
hello
:
public
eosio
::
contract
{
void
apply
(
uint64_t
receiver
,
uint64_t
code
,
uint64_t
action
)
{
public:
eosio
::
print
(
"Hello World: "
,
eosio
::
name
(
code
),
"->"
,
eosio
::
name
(
action
),
"
\n
"
);
using
contract
::
contract
;
/// @abi action
void
hi
(
account_name
user
)
{
print
(
"Hello, "
,
name
{
user
}
);
}
}
};
}
// extern "C"
EOSIO_ABI
(
hello
,
(
hi
)
)
programs/cleos/main.cpp
浏览文件 @
53d1ce1e
...
@@ -330,14 +330,13 @@ void print_action_tree( const fc::variant& action ) {
...
@@ -330,14 +330,13 @@ void print_action_tree( const fc::variant& action ) {
void
print_result
(
const
fc
::
variant
&
result
)
{
try
{
void
print_result
(
const
fc
::
variant
&
result
)
{
try
{
const
auto
&
processed
=
result
[
"processed"
];
const
auto
&
processed
=
result
[
"processed"
];
const
auto
&
transaction_id
=
processed
[
"id"
].
as_string
();
const
auto
&
transaction_id
=
processed
[
"id"
].
as_string
();
const
auto
&
receipt
=
processed
[
"receipt"
].
get_object
()
;
string
status
=
processed
[
"receipt"
].
is_object
()
?
processed
[
"receipt"
][
"status"
].
as_string
()
:
"failed"
;
const
auto
&
status
=
receipt
[
"status"
].
as_string
()
;
auto
net
=
processed
[
"net_usage"
].
as_int64
()
*
8
;
auto
net
=
receipt
[
"net_usage_words"
].
as_int64
()
*
8
;
auto
cpu
=
processed
[
"cpu_usage"
].
as_int64
()
/
1024
;
auto
cpu
=
receipt
[
"kcpu_usage"
].
as_int64
();
cerr
<<
status
<<
" transaction: "
<<
transaction_id
<<
" "
<<
net
<<
" bytes "
<<
cpu
<<
"k cycles
\n
"
;
cerr
<<
status
<<
" transaction: "
<<
transaction_id
<<
" "
<<
net
<<
" bytes "
<<
cpu
<<
"k cycles
\n
"
;
if
(
status
==
"
hard_fail
"
)
{
if
(
status
==
"
failed
"
)
{
auto
soft_except
=
processed
[
"except"
].
as
<
optional
<
fc
::
exception
>>
();
auto
soft_except
=
processed
[
"except"
].
as
<
optional
<
fc
::
exception
>>
();
if
(
soft_except
)
{
if
(
soft_except
)
{
edump
((
soft_except
->
to_detail_string
()));
edump
((
soft_except
->
to_detail_string
()));
...
@@ -859,6 +858,59 @@ struct vote_producers_subcommand {
...
@@ -859,6 +858,59 @@ struct vote_producers_subcommand {
}
}
};
};
struct
list_producers_subcommand
{
bool
print_json
=
false
;
bool
sort_names
=
false
;
list_producers_subcommand
(
CLI
::
App
*
actionRoot
)
{
auto
list_producers
=
actionRoot
->
add_subcommand
(
"listproducers"
,
localized
(
"List producers"
));
list_producers
->
add_flag
(
"--json,-j"
,
print_json
,
localized
(
"Output in JSON format"
)
);
list_producers
->
add_flag
(
"--sort-account-names,-n"
,
sort_names
,
localized
(
"Sort by account names (default order is by votes)"
)
);
list_producers
->
set_callback
([
this
]
{
auto
result
=
call
(
get_table_func
,
fc
::
mutable_variant_object
(
"json"
,
true
)
(
"code"
,
name
(
config
::
system_account_name
).
to_string
())
(
"scope"
,
name
(
config
::
system_account_name
).
to_string
())
(
"table"
,
"producers"
)
);
if
(
!
print_json
)
{
auto
res
=
result
.
as
<
eosio
::
chain_apis
::
read_only
::
get_table_rows_result
>
();
std
::
vector
<
std
::
tuple
<
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
>>
v
;
for
(
auto
&
row
:
res
.
rows
)
{
auto
&
r
=
row
.
get_object
();
v
.
emplace_back
(
r
[
"owner"
].
as_string
(),
r
[
"total_votes"
].
as_string
(),
r
[
"producer_key"
].
as_string
(),
r
[
"url"
].
as_string
()
);
}
if
(
!
v
.
empty
()
)
{
if
(
sort_names
)
{
std
::
sort
(
v
.
begin
(),
v
.
end
(),
[](
auto
a
,
auto
b
)
{
return
std
::
get
<
0
>
(
a
)
<
std
::
get
<
0
>
(
b
);
}
);
}
else
{
std
::
sort
(
v
.
begin
(),
v
.
end
(),
[](
auto
a
,
auto
b
)
{
return
std
::
get
<
1
>
(
a
)
<
std
::
get
<
1
>
(
b
)
||
(
std
::
get
<
1
>
(
a
)
==
std
::
get
<
1
>
(
b
)
&&
std
::
get
<
0
>
(
a
)
<
std
::
get
<
0
>
(
b
));
}
);
}
std
::
cout
<<
std
::
left
<<
std
::
setw
(
14
)
<<
"Producer"
<<
std
::
setw
(
55
)
<<
"Producer key"
<<
std
::
setw
(
50
)
<<
"Url"
<<
"Total votes"
<<
std
::
endl
;
for
(
auto
&
x
:
v
)
{
std
::
cout
<<
std
::
left
<<
std
::
setw
(
14
)
<<
std
::
get
<
0
>
(
x
)
<<
std
::
setw
(
55
)
<<
std
::
get
<
2
>
(
x
)
<<
std
::
setw
(
50
)
<<
std
::
get
<
3
>
(
x
)
<<
std
::
get
<
1
>
(
x
)
<<
std
::
endl
;
}
}
else
{
std
::
cout
<<
"No producers found"
<<
std
::
endl
;
}
}
else
{
if
(
sort_names
)
{
FC_THROW
(
"Sorting producers is not supported for JSON format"
);
}
std
::
cout
<<
fc
::
json
::
to_pretty_string
(
result
)
<<
std
::
endl
;
}
}
);
}
};
struct
delegate_bandwidth_subcommand
{
struct
delegate_bandwidth_subcommand
{
string
from_str
;
string
from_str
;
string
receiver_str
;
string
receiver_str
;
...
@@ -1118,8 +1170,8 @@ void get_account( const string& accountName, bool json_format ) {
...
@@ -1118,8 +1170,8 @@ void get_account( const string& accountName, bool json_format ) {
<<
indent
<<
"quota: "
<<
std
::
setw
(
15
)
<<
res
.
ram_quota
<<
" bytes used: "
<<
std
::
setw
(
15
)
<<
res
.
ram_usage
<<
" bytes"
<<
std
::
endl
<<
std
::
endl
;
<<
indent
<<
"quota: "
<<
std
::
setw
(
15
)
<<
res
.
ram_quota
<<
" bytes used: "
<<
std
::
setw
(
15
)
<<
res
.
ram_usage
<<
" bytes"
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
"net bandwidth:"
<<
std
::
endl
;
std
::
cout
<<
"net bandwidth:"
<<
std
::
endl
;
if
(
res
.
total_resources
.
is_object
()
&&
res
.
delegated_bandwidth
.
is_object
()
)
{
if
(
res
.
total_resources
.
is_object
()
)
{
asset
net_own
(
stoll
(
res
.
delegated_bandwidth
.
get_object
()[
"net_weight"
].
as_string
()
)
);
asset
net_own
(
res
.
delegated_bandwidth
.
is_object
()
?
stoll
(
res
.
delegated_bandwidth
.
get_object
()[
"net_weight"
].
as_string
()
)
:
0
);
auto
net_others
=
to_asset
(
res
.
total_resources
.
get_object
()[
"net_weight"
].
as_string
())
-
net_own
;
auto
net_others
=
to_asset
(
res
.
total_resources
.
get_object
()[
"net_weight"
].
as_string
())
-
net_own
;
std
::
cout
<<
indent
<<
"staked:"
<<
std
::
setw
(
20
)
<<
net_own
std
::
cout
<<
indent
<<
"staked:"
<<
std
::
setw
(
20
)
<<
net_own
<<
std
::
string
(
11
,
' '
)
<<
"(total stake delegated from account to self)"
<<
std
::
endl
<<
std
::
string
(
11
,
' '
)
<<
"(total stake delegated from account to self)"
<<
std
::
endl
...
@@ -1136,8 +1188,8 @@ void get_account( const string& accountName, bool json_format ) {
...
@@ -1136,8 +1188,8 @@ void get_account( const string& accountName, bool json_format ) {
std
::
cout
<<
"cpu bandwidth:"
<<
std
::
endl
;
std
::
cout
<<
"cpu bandwidth:"
<<
std
::
endl
;
if
(
res
.
total_resources
.
is_object
()
&&
res
.
delegated_bandwidth
.
is_object
()
)
{
if
(
res
.
total_resources
.
is_object
()
)
{
asset
cpu_own
(
stoll
(
res
.
delegated_bandwidth
.
get_object
()[
"cpu_weight"
].
as_string
()
)
);
asset
cpu_own
(
res
.
delegated_bandwidth
.
is_object
()
?
stoll
(
res
.
delegated_bandwidth
.
get_object
()[
"cpu_weight"
].
as_string
()
)
:
0
);
auto
cpu_others
=
to_asset
(
res
.
total_resources
.
get_object
()[
"cpu_weight"
].
as_string
())
-
cpu_own
;
auto
cpu_others
=
to_asset
(
res
.
total_resources
.
get_object
()[
"cpu_weight"
].
as_string
())
-
cpu_own
;
std
::
cout
<<
indent
<<
"staked:"
<<
std
::
setw
(
20
)
<<
cpu_own
std
::
cout
<<
indent
<<
"staked:"
<<
std
::
setw
(
20
)
<<
cpu_own
<<
std
::
string
(
11
,
' '
)
<<
"(total stake delegated from account to self)"
<<
std
::
endl
<<
std
::
string
(
11
,
' '
)
<<
"(total stake delegated from account to self)"
<<
std
::
endl
...
@@ -2153,6 +2205,8 @@ int main( int argc, char** argv ) {
...
@@ -2153,6 +2205,8 @@ int main( int argc, char** argv ) {
auto
voteProxy
=
vote_producer_proxy_subcommand
(
voteProducer
);
auto
voteProxy
=
vote_producer_proxy_subcommand
(
voteProducer
);
auto
voteProducers
=
vote_producers_subcommand
(
voteProducer
);
auto
voteProducers
=
vote_producers_subcommand
(
voteProducer
);
auto
listProducers
=
list_producers_subcommand
(
system
);
auto
delegateBandWidth
=
delegate_bandwidth_subcommand
(
system
);
auto
delegateBandWidth
=
delegate_bandwidth_subcommand
(
system
);
auto
undelegateBandWidth
=
undelegate_bandwidth_subcommand
(
system
);
auto
undelegateBandWidth
=
undelegate_bandwidth_subcommand
(
system
);
...
...
tests/CMakeLists.txt
浏览文件 @
53d1ce1e
...
@@ -38,7 +38,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/consensus-validation-malicious-produc
...
@@ -38,7 +38,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/consensus-validation-malicious-produc
#To run plugin_test with all log from blockchain displayed, put --verbose after --, i.e. plugin_test -- --verbose
#To run plugin_test with all log from blockchain displayed, put --verbose after --, i.e. plugin_test -- --verbose
add_test
(
NAME plugin_test COMMAND plugin_test --report_level=detailed --color_output
)
add_test
(
NAME plugin_test COMMAND plugin_test --report_level=detailed --color_output
)
add_test
(
NAME nodeos_run_test COMMAND tests/nodeos_run_test.py -v --dump-error-detail WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
add_test
(
NAME nodeos_run_test COMMAND tests/nodeos_run_test.py -v --
only-bios --
dump-error-detail WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
# TODO removed on slim: add_test(NAME nodeos_run_remote_test COMMAND tests/nodeos_run_remote_test.py -v --dump-error-detail WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO removed on slim: add_test(NAME nodeos_run_remote_test COMMAND tests/nodeos_run_remote_test.py -v --dump-error-detail WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO removed on slim: add_test(NAME p2p_dawn515_test COMMAND tests/p2p_tests/dawn_515/test.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO removed on slim: add_test(NAME p2p_dawn515_test COMMAND tests/p2p_tests/dawn_515/test.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
#if(BUILD_MONGO_DB_PLUGIN)
#if(BUILD_MONGO_DB_PLUGIN)
...
...
tests/nodeos_run_test.py
浏览文件 @
53d1ce1e
...
@@ -4,7 +4,6 @@ import testUtils
...
@@ -4,7 +4,6 @@ import testUtils
import
decimal
import
decimal
import
argparse
import
argparse
import
random
import
re
import
re
###############################################################
###############################################################
...
@@ -17,8 +16,8 @@ Print=testUtils.Utils.Print
...
@@ -17,8 +16,8 @@ Print=testUtils.Utils.Print
errorExit
=
testUtils
.
Utils
.
errorExit
errorExit
=
testUtils
.
Utils
.
errorExit
def
cmdError
(
name
,
code
=
0
,
exitNow
=
False
):
def
cmdError
(
name
,
c
mdC
ode
=
0
,
exitNow
=
False
):
msg
=
"FAILURE - %s%s"
%
(
name
,
(
""
if
c
ode
==
0
else
(
" returned error code %d"
%
c
ode
)))
msg
=
"FAILURE - %s%s"
%
(
name
,
(
""
if
c
mdCode
==
0
else
(
" returned error code %d"
%
cmdC
ode
)))
if
exitNow
:
if
exitNow
:
errorExit
(
msg
,
True
)
errorExit
(
msg
,
True
)
else
:
else
:
...
@@ -50,7 +49,7 @@ parser.add_argument("--keep-logs", help="Don't delete var/lib/node_* folders upo
...
@@ -50,7 +49,7 @@ parser.add_argument("--keep-logs", help="Don't delete var/lib/node_* folders upo
action
=
'store_true'
)
action
=
'store_true'
)
parser
.
add_argument
(
"-v"
,
help
=
"verbose logging"
,
action
=
'store_true'
)
parser
.
add_argument
(
"-v"
,
help
=
"verbose logging"
,
action
=
'store_true'
)
parser
.
add_argument
(
"--dont-kill"
,
help
=
"Leave cluster running after test finishes"
,
action
=
'store_true'
)
parser
.
add_argument
(
"--dont-kill"
,
help
=
"Leave cluster running after test finishes"
,
action
=
'store_true'
)
parser
.
add_argument
(
"--only-bios"
,
help
=
"Limit testing to bios node."
,
action
=
'store_
fals
e'
)
parser
.
add_argument
(
"--only-bios"
,
help
=
"Limit testing to bios node."
,
action
=
'store_
tru
e'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
testOutputFile
=
args
.
output
testOutputFile
=
args
.
output
...
@@ -65,6 +64,7 @@ keepLogs=args.keep_logs
...
@@ -65,6 +64,7 @@ keepLogs=args.keep_logs
dontLaunch
=
args
.
dont_launch
dontLaunch
=
args
.
dont_launch
dontKill
=
args
.
dont_kill
dontKill
=
args
.
dont_kill
prodCount
=
args
.
prod_count
prodCount
=
args
.
prod_count
onlyBios
=
args
.
only_bios
testUtils
.
Utils
.
Debug
=
debug
testUtils
.
Utils
.
Debug
=
debug
localTest
=
True
if
server
==
LOCAL_HOST
else
False
localTest
=
True
if
server
==
LOCAL_HOST
else
False
...
@@ -94,7 +94,7 @@ try:
...
@@ -94,7 +94,7 @@ try:
cluster
.
killall
()
cluster
.
killall
()
cluster
.
cleanup
()
cluster
.
cleanup
()
Print
(
"Stand up cluster"
)
Print
(
"Stand up cluster"
)
if
cluster
.
launch
(
prodCount
=
prodCount
,
onlyBios
=
True
,
dontKill
=
dontKill
)
is
False
:
if
cluster
.
launch
(
prodCount
=
prodCount
,
onlyBios
=
onlyBios
,
dontKill
=
dontKill
)
is
False
:
cmdError
(
"launcher"
)
cmdError
(
"launcher"
)
errorExit
(
"Failed to stand up eos cluster."
)
errorExit
(
"Failed to stand up eos cluster."
)
else
:
else
:
...
@@ -193,7 +193,7 @@ try:
...
@@ -193,7 +193,7 @@ try:
expectedkeys
.
append
(
account
.
activePrivateKey
)
expectedkeys
.
append
(
account
.
activePrivateKey
)
noMatch
=
list
(
set
(
expectedkeys
)
-
set
(
actualKeys
))
noMatch
=
list
(
set
(
expectedkeys
)
-
set
(
actualKeys
))
if
len
(
noMatch
)
>
0
:
if
len
(
noMatch
)
>
0
:
errorExit
(
"FAILURE - wallet keys did not include %s"
%
(
noMatch
),
raw
=
t
rue
)
errorExit
(
"FAILURE - wallet keys did not include %s"
%
(
noMatch
),
raw
=
T
rue
)
Print
(
"Locking all wallets."
)
Print
(
"Locking all wallets."
)
if
not
walletMgr
.
lockAllWallets
():
if
not
walletMgr
.
lockAllWallets
():
...
@@ -215,14 +215,14 @@ try:
...
@@ -215,14 +215,14 @@ try:
expectedkeys
=
[
initaAccount
.
ownerPrivateKey
]
expectedkeys
=
[
initaAccount
.
ownerPrivateKey
]
noMatch
=
list
(
set
(
expectedkeys
)
-
set
(
actualKeys
))
noMatch
=
list
(
set
(
expectedkeys
)
-
set
(
actualKeys
))
if
len
(
noMatch
)
>
0
:
if
len
(
noMatch
)
>
0
:
errorExit
(
"FAILURE - wallet keys did not include %s"
%
(
noMatch
),
raw
=
t
rue
)
errorExit
(
"FAILURE - wallet keys did not include %s"
%
(
noMatch
),
raw
=
T
rue
)
node
=
cluster
.
getNode
(
0
)
node
=
cluster
.
getNode
(
0
)
if
node
is
None
:
if
node
is
None
:
errorExit
(
"Cluster in bad state, received None node"
)
errorExit
(
"Cluster in bad state, received None node"
)
Print
(
"Create new account %s via %s"
%
(
testeraAccount
.
name
,
initaAccount
.
name
))
Print
(
"Create new account %s via %s"
%
(
testeraAccount
.
name
,
initaAccount
.
name
))
transId
=
node
.
createAccount
(
testeraAccount
,
initaAccount
,
stakedDeposit
=
0
,
waitForTransBlock
=
False
)
transId
=
node
.
create
Initialize
Account
(
testeraAccount
,
initaAccount
,
stakedDeposit
=
0
,
waitForTransBlock
=
False
)
if
transId
is
None
:
if
transId
is
None
:
cmdError
(
"%s create account"
%
(
ClientName
))
cmdError
(
"%s create account"
%
(
ClientName
))
errorExit
(
"Failed to create account %s"
%
(
testeraAccount
.
name
))
errorExit
(
"Failed to create account %s"
%
(
testeraAccount
.
name
))
...
@@ -238,14 +238,12 @@ try:
...
@@ -238,14 +238,12 @@ try:
errorExit
(
"Failed to transfer funds %d from account %s to %s"
%
(
errorExit
(
"Failed to transfer funds %d from account %s to %s"
%
(
transferAmount
,
initaAccount
.
name
,
testeraAccount
.
name
))
transferAmount
,
initaAccount
.
name
,
testeraAccount
.
name
))
# TBD: Known issue (Issue 2043) that 'get currency balance' doesn't return balance.
expectedAmount
=
transferAmount
# Uncomment when functional
Print
(
"Verify transfer, Expected: %s"
%
(
expectedAmount
))
# expectedAmount=transferAmount
actualAmount
=
node
.
getAccountEosBalanceStr
(
testeraAccount
.
name
)
# Print("Verify transfer, Expected: %d" % (expectedAmount))
if
expectedAmount
!=
actualAmount
:
# actualAmount=node.getAccountBalance(testeraAccount.name)
cmdError
(
"FAILURE - transfer failed"
)
# if expectedAmount != actualAmount:
errorExit
(
"Transfer verification failed. Excepted %s, actual: %s"
%
(
expectedAmount
,
actualAmount
))
# cmdError("FAILURE - transfer failed")
# errorExit("Transfer verification failed. Excepted %d, actual: %d" % (expectedAmount, actualAmount))
transferAmount
=
"0.0100 EOS"
transferAmount
=
"0.0100 EOS"
Print
(
"Force transfer funds %s from account %s to %s"
%
(
Print
(
"Force transfer funds %s from account %s to %s"
%
(
...
@@ -255,23 +253,21 @@ try:
...
@@ -255,23 +253,21 @@ try:
errorExit
(
"Failed to force transfer funds %d from account %s to %s"
%
(
errorExit
(
"Failed to force transfer funds %d from account %s to %s"
%
(
transferAmount
,
initaAccount
.
name
,
testeraAccount
.
name
))
transferAmount
,
initaAccount
.
name
,
testeraAccount
.
name
))
# TBD: Known issue (Issue 2043) that 'get currency balance' doesn't return balance.
expectedAmount
=
"97.5421 EOS"
# Uncomment when functional
Print
(
"Verify transfer, Expected: %s"
%
(
expectedAmount
))
# expectedAmount=975421
actualAmount
=
node
.
getAccountEosBalanceStr
(
testeraAccount
.
name
)
# Print("Verify transfer, Expected: %d" % (expectedAmount))
if
expectedAmount
!=
actualAmount
:
# actualAmount=node.getAccountBalance(testeraAccount.name)
cmdError
(
"FAILURE - transfer failed"
)
# if expectedAmount != actualAmount:
errorExit
(
"Transfer verification failed. Excepted %s, actual: %s"
%
(
expectedAmount
,
actualAmount
))
# cmdError("FAILURE - transfer failed")
# errorExit("Transfer verification failed. Excepted %d, actual: %d" % (expectedAmount, actualAmount))
Print
(
"Create new account %s via %s"
%
(
currencyAccount
.
name
,
initbAccount
.
name
))
Print
(
"Create new account %s via %s"
%
(
currencyAccount
.
name
,
initbAccount
.
name
))
transId
=
node
.
createAccount
(
currencyAccount
,
initbAccount
,
stakedDeposit
=
5000
)
transId
=
node
.
create
Initialize
Account
(
currencyAccount
,
initbAccount
,
stakedDeposit
=
5000
)
if
transId
is
None
:
if
transId
is
None
:
cmdError
(
"%s create account"
%
(
ClientName
))
cmdError
(
"%s create account"
%
(
ClientName
))
errorExit
(
"Failed to create account %s"
%
(
currencyAccount
.
name
))
errorExit
(
"Failed to create account %s"
%
(
currencyAccount
.
name
))
Print
(
"Create new account %s via %s"
%
(
exchangeAccount
.
name
,
initaAccount
.
name
))
Print
(
"Create new account %s via %s"
%
(
exchangeAccount
.
name
,
initaAccount
.
name
))
transId
=
node
.
createAccount
(
exchangeAccount
,
initaAccount
,
waitForTransBlock
=
True
)
transId
=
node
.
create
Initialize
Account
(
exchangeAccount
,
initaAccount
,
waitForTransBlock
=
True
)
if
transId
is
None
:
if
transId
is
None
:
cmdError
(
"%s create account"
%
(
ClientName
))
cmdError
(
"%s create account"
%
(
ClientName
))
errorExit
(
"Failed to create account %s"
%
(
exchangeAccount
.
name
))
errorExit
(
"Failed to create account %s"
%
(
exchangeAccount
.
name
))
...
@@ -296,17 +292,12 @@ try:
...
@@ -296,17 +292,12 @@ try:
transferAmount
,
initaAccount
.
name
,
testeraAccount
.
name
))
transferAmount
,
initaAccount
.
name
,
testeraAccount
.
name
))
transId
=
testUtils
.
Node
.
getTransId
(
trans
)
transId
=
testUtils
.
Node
.
getTransId
(
trans
)
# TBD: Known issue (Issue 2043) that 'get currency balance' doesn't return balance.
expectedAmount
=
"98.0311 EOS"
# 5000 initial deposit
# Uncomment when functional
Print
(
"Verify transfer, Expected: %s"
%
(
expectedAmount
))
# expectedAmount=975311+5000 # 5000 initial deposit
actualAmount
=
node
.
getAccountEosBalanceStr
(
currencyAccount
.
name
)
# Print("Verify transfer, Expected: %d" % (expectedAmount))
if
expectedAmount
!=
actualAmount
:
# actualAmount=node.getAccountBalance(currencyAccount.name)
cmdError
(
"FAILURE - transfer failed"
)
# if actualAmount is None:
errorExit
(
"Transfer verification failed. Excepted %s, actual: %s"
%
(
expectedAmount
,
actualAmount
))
# cmdError("%s get account currency" % (ClientName))
# errorExit("Failed to retrieve balance for account %s" % (currencyAccount.name))
# if expectedAmount != actualAmount:
# cmdError("FAILURE - transfer failed")
# errorExit("Transfer verification failed. Excepted %d, actual: %d" % (expectedAmount, actualAmount))
# Pre-mature exit on slim branch. This will pushed futher out as code stablizes.
# Pre-mature exit on slim branch. This will pushed futher out as code stablizes.
testSuccessful
=
True
testSuccessful
=
True
...
@@ -493,7 +484,6 @@ try:
...
@@ -493,7 +484,6 @@ try:
cmdError
(
"%s get transaction trans_id"
%
(
ClientName
))
cmdError
(
"%s get transaction trans_id"
%
(
ClientName
))
errorExit
(
"Failed to verify push message transaction id."
)
errorExit
(
"Failed to verify push message transaction id."
)
# TODO need to update eosio.system contract to use new currency and update cleos and chain_plugin for interaction
Print
(
"read current contract balance"
)
Print
(
"read current contract balance"
)
contract
=
"currency"
contract
=
"currency"
table
=
"accounts"
table
=
"accounts"
...
...
tests/testUtils.py
浏览文件 @
53d1ce1e
此差异已折叠。
点击以展开。
tools/ctestwrapper.sh
浏览文件 @
53d1ce1e
#!/bin/sh
#!/bin/sh
# run ctest, disregard failure code
# run ctest, disregard failure code
ctest
$@
ctest
--output-on-failure
$@
exit
0
exit
0
unittests/CMakeLists.txt
浏览文件 @
53d1ce1e
...
@@ -73,7 +73,7 @@ if(ENABLE_COVERAGE_TESTING)
...
@@ -73,7 +73,7 @@ if(ENABLE_COVERAGE_TESTING)
COMMAND
${
LCOV_PATH
}
--directory . --capture --gcov-tool ./tools/llvm-gcov.sh --output-file
${
Coverage_NAME
}
.info
COMMAND
${
LCOV_PATH
}
--directory . --capture --gcov-tool ./tools/llvm-gcov.sh --output-file
${
Coverage_NAME
}
.info
COMMAND
${
LCOV_PATH
}
-remove
${
Coverage_NAME
}
.info '
boost/*' '/usr/lib/*' '/usr/include/*' '/externals/*' 'fc/*' '
wasm-jit/*' --output-file
${
Coverage_NAME
}
_filtered.info
COMMAND
${
LCOV_PATH
}
-remove
${
Coverage_NAME
}
.info '
*/boost/*' '/usr/lib/*' '/usr/include/*' '*/externals/*' '*/fc/*' '*/
wasm-jit/*' --output-file
${
Coverage_NAME
}
_filtered.info
COMMAND
${
GENHTML_PATH
}
-o
${
Coverage_NAME
}
${
PROJECT_BINARY_DIR
}
/
${
Coverage_NAME
}
_filtered.info
COMMAND
${
GENHTML_PATH
}
-o
${
Coverage_NAME
}
${
PROJECT_BINARY_DIR
}
/
${
Coverage_NAME
}
_filtered.info
COMMAND
${
CMAKE_COMMAND
}
-E remove
${
Coverage_NAME
}
.base
${
Coverage_NAME
}
.info
${
Coverage_NAME
}
_filtered.info
${
Coverage_NAME
}
.total
${
PROJECT_BINARY_DIR
}
/
${
Coverage_NAME
}
.info.cleaned
${
PROJECT_BINARY_DIR
}
/
${
Coverage_NAME
}
_filtered.info.cleaned
COMMAND
${
CMAKE_COMMAND
}
-E remove
${
Coverage_NAME
}
.base
${
Coverage_NAME
}
.info
${
Coverage_NAME
}
_filtered.info
${
Coverage_NAME
}
.total
${
PROJECT_BINARY_DIR
}
/
${
Coverage_NAME
}
.info.cleaned
${
PROJECT_BINARY_DIR
}
/
${
Coverage_NAME
}
_filtered.info.cleaned
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录