1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

pow-testgiver support

This commit is contained in:
ton 2020-07-06 17:07:20 +03:00
parent dbde9c1c40
commit f064b1047a
257 changed files with 6665 additions and 2608 deletions

View file

@ -30,7 +30,7 @@
#include "adnl/adnl-test-loopback-implementation.h"
#include "dht/dht.h"
#include "overlay/overlays.h"
#include "td/utils/OptionsParser.h"
#include "td/utils/OptionParser.h"
#include "td/utils/Time.h"
#include "td/utils/filesystem.h"
#include "td/utils/format.h"

View file

@ -30,7 +30,7 @@
#include "auto/tl/ton_api_json.h"
#include "dht/dht.h"
#include "overlay/overlays.h"
#include "td/utils/OptionsParser.h"
#include "td/utils/OptionParser.h"
#include "td/utils/Time.h"
#include "td/utils/filesystem.h"
#include "td/utils/format.h"
@ -165,7 +165,7 @@ int main(int argc, char *argv[]) {
td::actor::ActorOwn<TestNode> x;
td::OptionsParser p;
td::OptionParser p;
p.set_description("test basic adnl functionality");
p.add_option('h', "help", "prints_help", [&]() {
char b[10240];

View file

@ -30,7 +30,7 @@
#include "auto/tl/ton_api_json.h"
#include "dht/dht.h"
#include "overlay/overlays.h"
#include "td/utils/OptionsParser.h"
#include "td/utils/OptionParser.h"
#include "td/utils/Time.h"
#include "td/utils/filesystem.h"
#include "td/utils/format.h"
@ -166,7 +166,7 @@ int main(int argc, char *argv[]) {
td::actor::ActorOwn<TestNode> x;
td::OptionsParser p;
td::OptionParser p;
p.set_description("test basic adnl functionality");
p.add_option('h', "help", "prints_help", [&]() {
char b[10240];

View file

@ -95,7 +95,7 @@ int main() {
auto decode_encode = [](auto obj_json) {
auto as_json_value = td::json_decode(obj_json).move_as_ok();
ton::ton_api::object_ptr<ton::ton_api::Object> obj2;
from_json(obj2, as_json_value).ensure();
from_json(obj2, std::move(as_json_value)).ensure();
CHECK(obj2 != nullptr);
return td::json_encode<std::string>(td::ToJson(obj2));
};

View file

@ -25,7 +25,7 @@
Copyright 2017-2020 Telegram Systems LLP
*/
#include "td/utils/OptionsParser.h"
#include "td/utils/OptionParser.h"
#include "td/utils/Time.h"
#include "td/utils/filesystem.h"
#include "td/utils/format.h"

View file

@ -30,7 +30,7 @@
#include "auto/tl/ton_api_json.h"
#include "dht/dht.h"
#include "overlay/overlays.h"
#include "td/utils/OptionsParser.h"
#include "td/utils/OptionParser.h"
#include "td/utils/Time.h"
#include "td/utils/filesystem.h"
#include "td/utils/format.h"
@ -321,7 +321,7 @@ int main(int argc, char *argv[]) {
td::actor::ActorOwn<TestNode> x;
td::OptionsParser p;
td::OptionParser p;
p.set_description("test basic adnl functionality");
p.add_option('h', "help", "prints_help", [&]() {
char b[10240];

View file

@ -23,7 +23,7 @@
exception statement from your version. If you delete this exception statement
from all source files in the program, then also delete it here.
Copyright 2017-2019 Telegram Systems LLP
Copyright 2017-2020 Telegram Systems LLP
*/
#include "adnl/adnl-network-manager.h"
#include "adnl/adnl-test-loopback-implementation.h"

View file

@ -26,7 +26,7 @@
Copyright 2017-2020 Telegram Systems LLP
*/
#include "td/db/RocksDb.h"
#include "td/utils/OptionsParser.h"
#include "td/utils/OptionParser.h"
#include "td/utils/port/signals.h"
#include "td/utils/port/path.h"
#include "td/utils/StringBuilder.h"
@ -69,7 +69,7 @@ int main(int argc, char *argv[]) {
SET_VERBOSITY_LEVEL(verbosity_DEBUG);
td::set_default_failure_signal_handler().ensure();
td::OptionsParser p;
td::OptionParser p;
p.set_description("test basic adnl functionality");
p.add_option('h', "help", "prints_help", [&]() {
char b[10240];
@ -77,13 +77,9 @@ int main(int argc, char *argv[]) {
sb << p;
std::cout << sb.as_cslice().c_str();
std::exit(2);
return td::Status::OK();
});
bool create_db = false;
p.add_option('c', "create", "create test db", [&] {
create_db = true;
return td::Status::OK();
});
p.add_option('c', "create", "create test db", [&] { create_db = true; });
auto res = p.run(argc, argv);
LOG_IF(FATAL, res.is_error()) << res.error();

View file

@ -34,7 +34,7 @@
int main(int argc, char **argv) {
td::set_default_failure_signal_handler().ensure();
// TODO port OptionsParser to Windows
// TODO port OptionParser to Windows
auto &runner = td::TestsRunner::get_default();
for (int i = 1; i < argc; i++) {
if (!std::strcmp(argv[i], "--filter")) {

View file

@ -30,7 +30,7 @@
#include "auto/tl/ton_api_json.h"
#include "dht/dht.h"
#include "overlay/overlays.h"
#include "td/utils/OptionsParser.h"
#include "td/utils/OptionParser.h"
#include "td/utils/Time.h"
#include "td/utils/filesystem.h"
#include "td/utils/format.h"
@ -347,7 +347,7 @@ int main(int argc, char *argv[]) {
td::actor::ActorOwn<TestNode> x;
td::OptionsParser p;
td::OptionParser p;
p.set_description("test collate block");
p.add_option('h', "help", "prints_help", [&]() {
char b[10240];
@ -355,39 +355,26 @@ int main(int argc, char *argv[]) {
sb << p;
std::cout << sb.as_cslice().c_str();
std::exit(2);
return td::Status::OK();
});
p.add_option('Z', "zero-root-hash", "zero state root hash (base64url-encoded)", [&](td::Slice fname) {
td::actor::send_closure(x, &TestNode::set_zero_root_hash, get_uint256(fname).move_as_ok());
return td::Status::OK();
});
p.add_option('F', "zero-file-hash", "zero state file hash (base64url-encoded)", [&](td::Slice fname) {
td::actor::send_closure(x, &TestNode::set_zero_file_hash, get_uint256(fname).move_as_ok());
return td::Status::OK();
});
p.add_option('z', "zero-state-file", "zero state file", [&](td::Slice fname) {
td::actor::send_closure(x, &TestNode::set_zero_file, fname.str());
return td::Status::OK();
});
p.add_option('D', "db", "root for dbs", [&](td::Slice fname) {
td::actor::send_closure(x, &TestNode::set_db_root, fname.str());
return td::Status::OK();
});
p.add_option('m', "ext-message", "binary file with serialized inbound external message", [&](td::Slice fname) {
td::actor::send_closure(x, &TestNode::load_ext_message, fname.str());
return td::Status::OK();
});
p.add_option('z', "zero-state-file", "zero state file",
[&](td::Slice fname) { td::actor::send_closure(x, &TestNode::set_zero_file, fname.str()); });
p.add_option('D', "db", "root for dbs",
[&](td::Slice fname) { td::actor::send_closure(x, &TestNode::set_db_root, fname.str()); });
p.add_option('m', "ext-message", "binary file with serialized inbound external message",
[&](td::Slice fname) { td::actor::send_closure(x, &TestNode::load_ext_message, fname.str()); });
p.add_option('M', "top-shard-message", "binary file with serialized shard top block description",
[&](td::Slice fname) {
td::actor::send_closure(x, &TestNode::load_shard_block_message, fname.str());
return td::Status::OK();
});
[&](td::Slice fname) { td::actor::send_closure(x, &TestNode::load_shard_block_message, fname.str()); });
p.add_option('v', "verbosity", "set verbosity level", [&](td::Slice arg) {
int v = VERBOSITY_NAME(FATAL) + (verbosity = td::to_integer<int>(arg));
SET_VERBOSITY_LEVEL(v);
return td::Status::OK();
});
p.add_option('w', "workchain", "<workchain>[:<shard>]\tcollate block in this workchain", [&](td::Slice arg) {
p.add_checked_option('w', "workchain", "<workchain>[:<shard>]\tcollate block in this workchain", [&](td::Slice arg) {
ton::ShardId shard = 0;
auto pos = std::min(arg.find(':'), arg.size());
TRY_RESULT(workchain, td::to_integer_safe<int>(arg.substr(0, pos)));
@ -403,31 +390,24 @@ int main(int argc, char *argv[]) {
td::actor::send_closure(x, &TestNode::set_shard, ton::ShardIdFull{workchain, shard ? shard : ton::shardIdAll});
return td::Status::OK();
});
p.add_option('S', "want-split", "forces setting want_split in the header of new shard block", [&]() {
td::actor::send_closure(x, &TestNode::set_collator_flags, 1);
return td::Status::OK();
});
p.add_option('G', "want-merge", "forces setting want_merge in the header of new shard block", [&]() {
td::actor::send_closure(x, &TestNode::set_collator_flags, 2);
return td::Status::OK();
});
p.add_option('S', "want-split", "forces setting want_split in the header of new shard block",
[&]() { td::actor::send_closure(x, &TestNode::set_collator_flags, 1); });
p.add_option('G', "want-merge", "forces setting want_merge in the header of new shard block",
[&]() { td::actor::send_closure(x, &TestNode::set_collator_flags, 2); });
p.add_option('s', "save-top-descr", "saves generated shard top block description into files with specified prefix",
[&](td::Slice arg) {
td::actor::send_closure(x, &TestNode::set_top_descr_prefix, arg.str());
return td::Status::OK();
});
p.add_option('T', "top-block", "BlockIdExt of top block (new block will be generated atop of it)",
[&](td::Slice arg) {
ton::BlockIdExt block_id;
if (block::parse_block_id_ext(arg, block_id)) {
LOG(INFO) << "setting previous block to " << block_id.to_str();
td::actor::send_closure(x, &TestNode::set_shard_top_block, block_id);
[&](td::Slice arg) { td::actor::send_closure(x, &TestNode::set_top_descr_prefix, arg.str()); });
p.add_checked_option('T', "top-block", "BlockIdExt of top block (new block will be generated atop of it)",
[&](td::Slice arg) {
ton::BlockIdExt block_id;
if (block::parse_block_id_ext(arg, block_id)) {
LOG(INFO) << "setting previous block to " << block_id.to_str();
td::actor::send_closure(x, &TestNode::set_shard_top_block, block_id);
return td::Status::OK();
} else {
return td::Status::Error("cannot parse BlockIdExt");
}
});
return td::Status::OK();
} else {
return td::Status::Error("cannot parse BlockIdExt");
}
});
p.add_option('d', "daemonize", "set SIGHUP", [&]() {
td::set_signal_handler(td::SignalType::HangUp, [](int sig) {
#if TD_DARWIN || TD_LINUX
@ -435,7 +415,6 @@ int main(int argc, char *argv[]) {
setsid();
#endif
}).ensure();
return td::Status::OK();
});
td::actor::Scheduler scheduler({7});

View file

@ -31,7 +31,7 @@
#include "auto/tl/ton_api_json.h"
#include "dht/dht.h"
#include "overlay/overlays.h"
#include "td/utils/OptionsParser.h"
#include "td/utils/OptionParser.h"
#include "td/utils/Time.h"
#include "td/utils/filesystem.h"
#include "td/utils/format.h"
@ -304,7 +304,7 @@ int main(int argc, char *argv[]) {
td::actor::ActorOwn<TestNode> x;
td::OptionsParser p;
td::OptionParser p;
p.set_description("test basic adnl functionality");
p.add_option('h', "help", "prints_help", [&]() {
char b[10240];

View file

@ -32,7 +32,7 @@
#include "auto/tl/ton_api.hpp"
#include "dht/dht.h"
#include "overlay/overlays.h"
#include "td/utils/OptionsParser.h"
#include "td/utils/OptionParser.h"
#include "td/utils/Time.h"
#include "td/utils/TsFileLog.h"
#include "td/utils/filesystem.h"
@ -290,7 +290,7 @@ int main(int argc, char *argv[]) {
td::log_interface = td::default_log_interface;
};
td::OptionsParser p;
td::OptionParser p;
p.set_description("test basic adnl functionality");
p.add_option('v', "verbosity", "set verbosity level", [&](td::Slice arg) {
int v = VERBOSITY_NAME(FATAL) + (td::to_integer<int>(arg));