diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core_proxy/core_proxy.cpp | 3 | ||||
-rw-r--r-- | tests/core_tests/block_validation.cpp | 2 | ||||
-rw-r--r-- | tests/fuzz/levin.cpp | 5 | ||||
-rw-r--r-- | tests/performance_tests/main.cpp | 4 | ||||
-rw-r--r-- | tests/unit_tests/dns_resolver.cpp | 28 |
5 files changed, 23 insertions, 19 deletions
diff --git a/tests/core_proxy/core_proxy.cpp b/tests/core_proxy/core_proxy.cpp index 8c9340318..f0a1eb5ce 100644 --- a/tests/core_proxy/core_proxy.cpp +++ b/tests/core_proxy/core_proxy.cpp @@ -80,8 +80,7 @@ int main(int argc, char* argv[]) po::options_description desc("Allowed options"); - // tools::get_default_data_dir() can't be called during static initialization - command_line::add_arg(desc, cryptonote::arg_data_dir, tools::get_default_data_dir()); + command_line::add_arg(desc, cryptonote::arg_data_dir); nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<tests::proxy_core> >::init_options(desc); po::variables_map vm; diff --git a/tests/core_tests/block_validation.cpp b/tests/core_tests/block_validation.cpp index b9818d2c5..598cd4098 100644 --- a/tests/core_tests/block_validation.cpp +++ b/tests/core_tests/block_validation.cpp @@ -38,7 +38,7 @@ namespace { bool lift_up_difficulty(std::vector<test_event_entry>& events, std::vector<uint64_t>& timestamps, std::vector<difficulty_type>& cummulative_difficulties, test_generator& generator, - size_t new_block_count, const block blk_last, const account_base& miner_account) + size_t new_block_count, const block &blk_last, const account_base& miner_account) { difficulty_type commulative_diffic = cummulative_difficulties.empty() ? 0 : cummulative_difficulties.back(); block blk_prev = blk_last; diff --git a/tests/fuzz/levin.cpp b/tests/fuzz/levin.cpp index 2c3971470..6a164dda9 100644 --- a/tests/fuzz/levin.cpp +++ b/tests/fuzz/levin.cpp @@ -299,7 +299,7 @@ int LevinFuzzer::run(const std::string &filename) { std::string s; -// +#if 0 epee::levin::bucket_head2 req_head; req_head.m_signature = LEVIN_SIGNATURE; req_head.m_cb = 0; @@ -307,10 +307,11 @@ int LevinFuzzer::run(const std::string &filename) req_head.m_command = 2000; req_head.m_flags = LEVIN_PACKET_REQUEST; req_head.m_protocol_version = LEVIN_PROTOCOL_VER_1; + req_head.m_return_code = 0; FILE *f=fopen("/tmp/out.levin", "w"); fwrite(&req_head,sizeof(req_head),1, f); fclose(f); -// +#endif if (!epee::file_io_utils::load_file_to_string(filename, s)) { std::cout << "Error: failed to load file " << filename << std::endl; diff --git a/tests/performance_tests/main.cpp b/tests/performance_tests/main.cpp index d1b79d026..902bd89c0 100644 --- a/tests/performance_tests/main.cpp +++ b/tests/performance_tests/main.cpp @@ -75,6 +75,7 @@ std::string glob_to_regex(const std::string &val) int main(int argc, char** argv) { + TRY_ENTRY(); tools::on_startup(); set_process_affinity(1); set_thread_high_priority(); @@ -84,7 +85,7 @@ int main(int argc, char** argv) po::options_description desc_options("Command line options"); const command_line::arg_descriptor<std::string> arg_filter = { "filter", "Regular expression filter for which tests to run" }; - command_line::add_arg(desc_options, arg_filter, ""); + command_line::add_arg(desc_options, arg_filter); po::variables_map vm; bool r = command_line::handle_error_helper(desc_options, [&]() @@ -172,4 +173,5 @@ int main(int argc, char** argv) std::cout << "Tests finished. Elapsed time: " << timer.elapsed_ms() / 1000 << " sec" << std::endl; return 0; + CATCH_ENTRY_L0("main", 1); } diff --git a/tests/unit_tests/dns_resolver.cpp b/tests/unit_tests/dns_resolver.cpp index c3807315e..2b3627f02 100644 --- a/tests/unit_tests/dns_resolver.cpp +++ b/tests/unit_tests/dns_resolver.cpp @@ -158,16 +158,18 @@ TEST(DNSResolver, GetTXTRecord) EXPECT_STREQ("donate.getmonero.org", addr.c_str()); } -TEST(DNS_PUBLIC, empty) { EXPECT_STREQ("", tools::dns_utils::parse_dns_public("").c_str()); } -TEST(DNS_PUBLIC, default) { EXPECT_STREQ("8.8.4.4", tools::dns_utils::parse_dns_public("tcp").c_str()); } -TEST(DNS_PUBLIC, invalid_scheme) { EXPECT_STREQ("", tools::dns_utils::parse_dns_public("invalid").c_str()); } -TEST(DNS_PUBLIC, invalid_ip_alpha) { EXPECT_STREQ("", tools::dns_utils::parse_dns_public("tcp://invalid").c_str()); } -TEST(DNS_PUBLIC, invalid_ip_num1) { EXPECT_STREQ("", tools::dns_utils::parse_dns_public("tcp://3").c_str()); } -TEST(DNS_PUBLIC, invalid_ip_num3) { EXPECT_STREQ("", tools::dns_utils::parse_dns_public("tcp://3.4.5").c_str()); } -TEST(DNS_PUBLIC, invalid_ip_num4_extra) { EXPECT_STREQ("", tools::dns_utils::parse_dns_public("tcp://3.4.5.6x").c_str()); } -TEST(DNS_PUBLIC, invalid_ip_num4_range) { EXPECT_STREQ("", tools::dns_utils::parse_dns_public("tcp://3.4.542.6").c_str()); } -TEST(DNS_PUBLIC, invalid_ip_dot) { EXPECT_STREQ("", tools::dns_utils::parse_dns_public("tcp://3.4.5.6.").c_str()); } -TEST(DNS_PUBLIC, invalid_ip_num5) { EXPECT_STREQ("", tools::dns_utils::parse_dns_public("tcp://3.4.5.6.7").c_str()); } -TEST(DNS_PUBLIC, invalid_ip_4_missing) { EXPECT_STREQ("", tools::dns_utils::parse_dns_public("tcp://3.4..7").c_str()); } -TEST(DNS_PUBLIC, valid_ip_lo) { EXPECT_STREQ("127.0.0.1", tools::dns_utils::parse_dns_public("tcp://127.0.0.1").c_str()); } -TEST(DNS_PUBLIC, valid_ip) { EXPECT_STREQ("3.4.5.6", tools::dns_utils::parse_dns_public("tcp://3.4.5.6").c_str()); } +bool is_equal(const char *s, const std::vector<std::string> &v) { return v.size() == 1 && v[0] == s; } + +TEST(DNS_PUBLIC, empty) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("").empty()); } +TEST(DNS_PUBLIC, default) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("tcp").size() > 0); } +TEST(DNS_PUBLIC, invalid_scheme) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("invalid").empty()); } +TEST(DNS_PUBLIC, invalid_ip_alpha) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("tcp://invalid").empty()); } +TEST(DNS_PUBLIC, invalid_ip_num1) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("tcp://3").empty()); } +TEST(DNS_PUBLIC, invalid_ip_num3) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("tcp://3.4.5").empty()); } +TEST(DNS_PUBLIC, invalid_ip_num4_extra) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("tcp://3.4.5.6x").empty()); } +TEST(DNS_PUBLIC, invalid_ip_num4_range) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("tcp://3.4.542.6").empty()); } +TEST(DNS_PUBLIC, invalid_ip_dot) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("tcp://3.4.5.6.").empty()); } +TEST(DNS_PUBLIC, invalid_ip_num5) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("tcp://3.4.5.6.7").empty()); } +TEST(DNS_PUBLIC, invalid_ip_4_missing) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("tcp://3.4..7").empty()); } +TEST(DNS_PUBLIC, valid_ip_lo) { EXPECT_TRUE(is_equal("127.0.0.1", tools::dns_utils::parse_dns_public("tcp://127.0.0.1"))); } +TEST(DNS_PUBLIC, valid_ip) { EXPECT_TRUE(is_equal("3.4.5.6", tools::dns_utils::parse_dns_public("tcp://3.4.5.6"))); } |