aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-03-19 21:48:36 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-03-19 21:48:36 +0000
commitfff238ec94ac6d45fc18c315d7bc590ddfaad63d (patch)
treed138554a5a13e650f45f3d8d4b8bd0c9c1748235 /tests
parentMerge pull request #732 (diff)
downloadmonero-fff238ec94ac6d45fc18c315d7bc590ddfaad63d.tar.xz
Print stack trace upon exceptions
Useful for debugging users' logs
Diffstat (limited to 'tests')
-rw-r--r--tests/core_proxy/core_proxy.h2
-rw-r--r--tests/core_tests/chaingen.cpp12
-rw-r--r--tests/core_tests/chaingen.h6
-rw-r--r--tests/core_tests/tx_validation.cpp2
-rw-r--r--tests/net_load_tests/clt.cpp1
-rw-r--r--tests/net_load_tests/srv.cpp1
-rw-r--r--tests/unit_tests/ban.cpp2
-rw-r--r--tests/unit_tests/epee_boosted_tcp_server.cpp2
-rw-r--r--tests/unit_tests/mnemonics.cpp1
-rw-r--r--tests/unit_tests/test_protocol_pack.cpp1
10 files changed, 17 insertions, 13 deletions
diff --git a/tests/core_proxy/core_proxy.h b/tests/core_proxy/core_proxy.h
index 0315fc8c8..22f4c0421 100644
--- a/tests/core_proxy/core_proxy.h
+++ b/tests/core_proxy/core_proxy.h
@@ -82,7 +82,7 @@ namespace tests
bool on_idle(){return true;}
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, cryptonote::NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp){return true;}
bool handle_get_objects(cryptonote::NOTIFY_REQUEST_GET_OBJECTS::request& arg, cryptonote::NOTIFY_RESPONSE_GET_OBJECTS::request& rsp, cryptonote::cryptonote_connection_context& context){return true;}
- cryptonote::blockchain_storage &get_blockchain_storage() { throw std::runtime_error("Called invalid member function: please never call get_blockchain_storage on the TESTING class proxy_core."); }
+ cryptonote::blockchain_storage &get_blockchain_storage() { throw tools::runtime_error("Called invalid member function: please never call get_blockchain_storage on the TESTING class proxy_core."); }
bool get_test_drop_download() {return true;}
bool get_test_drop_download_height() {return true;}
bool prepare_handle_incoming_blocks(const std::list<cryptonote::block_complete_entry> &blocks) { return true; }
diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp
index 4fdd0a600..b897d9237 100644
--- a/tests/core_tests/chaingen.cpp
+++ b/tests/core_tests/chaingen.cpp
@@ -58,7 +58,7 @@ void test_generator::get_block_chain(std::vector<block_info>& blockchain, const
auto it = m_blocks_info.find(curr);
if (m_blocks_info.end() == it)
{
- throw std::runtime_error("block hash wasn't found");
+ throw tools::runtime_error("block hash wasn't found");
}
blockchain.push_back(it->second);
@@ -82,7 +82,7 @@ uint64_t test_generator::get_already_generated_coins(const crypto::hash& blk_id)
{
auto it = m_blocks_info.find(blk_id);
if (it == m_blocks_info.end())
- throw std::runtime_error("block hash wasn't found");
+ throw tools::runtime_error("block hash wasn't found");
return it->second.already_generated_coins;
}
@@ -323,7 +323,7 @@ bool init_output_indices(map_output_idx_t& outs, std::map<uint64_t, std::vector<
BOOST_FOREACH(const crypto::hash &h, blk.tx_hashes) {
const map_hash2tx_t::const_iterator cit = mtx.find(h);
if (mtx.end() == cit)
- throw std::runtime_error("block contains an unknown tx hash");
+ throw tools::runtime_error("block contains an unknown tx hash");
vtx.push_back(cit->second);
}
@@ -486,11 +486,11 @@ void fill_tx_sources_and_destinations(const std::vector<test_event_entry>& event
destinations.clear();
if (!fill_tx_sources(sources, events, blk_head, from, amount + fee, nmix))
- throw std::runtime_error("couldn't fill transaction sources");
+ throw tools::runtime_error("couldn't fill transaction sources");
tx_destination_entry de;
if (!fill_tx_destination(de, to, amount))
- throw std::runtime_error("couldn't fill transaction destination");
+ throw tools::runtime_error("couldn't fill transaction destination");
destinations.push_back(de);
tx_destination_entry de_change;
@@ -498,7 +498,7 @@ void fill_tx_sources_and_destinations(const std::vector<test_event_entry>& event
if (0 < cache_back)
{
if (!fill_tx_destination(de_change, from, cache_back))
- throw std::runtime_error("couldn't fill transaction cache back destination");
+ throw tools::runtime_error("couldn't fill transaction cache back destination");
destinations.push_back(de_change);
}
}
diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h
index d0d912cbb..d51d9d320 100644
--- a/tests/core_tests/chaingen.h
+++ b/tests/core_tests/chaingen.h
@@ -284,7 +284,7 @@ bool do_check_tx_verification_context(const cryptonote::tx_verification_context&
{
// Default block verification context check
if (tvc.m_verifivation_failed)
- throw std::runtime_error("Transaction verification failed");
+ throw tools::runtime_error("Transaction verification failed");
return true;
}
//--------------------------------------------------------------------------
@@ -307,7 +307,7 @@ bool do_check_block_verification_context(const cryptonote::block_verification_co
{
// Default block verification context check
if (bvc.m_verifivation_failed)
- throw std::runtime_error("Block verification failed");
+ throw tools::runtime_error("Block verification failed");
return true;
}
//--------------------------------------------------------------------------
@@ -621,7 +621,7 @@ inline bool do_replay_file(const std::string& filename)
if (!tools::serialize_obj_to_file(events, filename)) \
{ \
std::cout << concolor::magenta << "Failed to serialize data to file: " << filename << concolor::normal << std::endl; \
- throw std::runtime_error("Failed to serialize data to file"); \
+ throw tools::runtime_error("Failed to serialize data to file"); \
} \
}
diff --git a/tests/core_tests/tx_validation.cpp b/tests/core_tests/tx_validation.cpp
index f72c906e5..41d5f1e26 100644
--- a/tests/core_tests/tx_validation.cpp
+++ b/tests/core_tests/tx_validation.cpp
@@ -156,7 +156,7 @@ namespace
}
}
- throw std::runtime_error("invalid public key wasn't found");
+ throw tools::runtime_error("invalid public key wasn't found");
return crypto::public_key();
}
}
diff --git a/tests/net_load_tests/clt.cpp b/tests/net_load_tests/clt.cpp
index 56089a4da..360261676 100644
--- a/tests/net_load_tests/clt.cpp
+++ b/tests/net_load_tests/clt.cpp
@@ -37,6 +37,7 @@
#include "gtest/gtest.h"
+#include "common/exception.h"
#include "include_base_utils.h"
#include "misc_language.h"
#include "misc_log_ex.h"
diff --git a/tests/net_load_tests/srv.cpp b/tests/net_load_tests/srv.cpp
index d8d3eae2e..13b31215e 100644
--- a/tests/net_load_tests/srv.cpp
+++ b/tests/net_load_tests/srv.cpp
@@ -31,6 +31,7 @@
#include <mutex>
#include <thread>
+#include "common/exception.h"
#include "include_base_utils.h"
#include "misc_log_ex.h"
#include "storages/levin_abstract_invoke2.h"
diff --git a/tests/unit_tests/ban.cpp b/tests/unit_tests/ban.cpp
index a5ce244d9..5d40e90cf 100644
--- a/tests/unit_tests/ban.cpp
+++ b/tests/unit_tests/ban.cpp
@@ -56,7 +56,7 @@ public:
bool on_idle(){return true;}
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, cryptonote::NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp){return true;}
bool handle_get_objects(cryptonote::NOTIFY_REQUEST_GET_OBJECTS::request& arg, cryptonote::NOTIFY_RESPONSE_GET_OBJECTS::request& rsp, cryptonote::cryptonote_connection_context& context){return true;}
- cryptonote::blockchain_storage &get_blockchain_storage() { throw std::runtime_error("Called invalid member function: please never call get_blockchain_storage on the TESTING class test_core."); }
+ cryptonote::blockchain_storage &get_blockchain_storage() { throw tools::runtime_error("Called invalid member function: please never call get_blockchain_storage on the TESTING class test_core."); }
bool get_test_drop_download() const {return true;}
bool get_test_drop_download_height() const {return true;}
bool prepare_handle_incoming_blocks(const std::list<cryptonote::block_complete_entry> &blocks) { return true; }
diff --git a/tests/unit_tests/epee_boosted_tcp_server.cpp b/tests/unit_tests/epee_boosted_tcp_server.cpp
index 946db292d..b68ce77bb 100644
--- a/tests/unit_tests/epee_boosted_tcp_server.cpp
+++ b/tests/unit_tests/epee_boosted_tcp_server.cpp
@@ -104,7 +104,7 @@ TEST(boosted_tcp_server, worker_threads_are_exception_resistant)
// 2 theads, but 4 exceptions
ASSERT_TRUE(srv.run_server(2, false));
- ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw std::runtime_error("test 1"); }));
+ ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw tools::runtime_error("test 1"); }));
ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw std::string("test 2"); }));
ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw "test 3"; }));
ASSERT_TRUE(srv.async_call([&counter_incrementer]() { counter_incrementer(); throw 4; }));
diff --git a/tests/unit_tests/mnemonics.cpp b/tests/unit_tests/mnemonics.cpp
index 3dc5db7d4..3bf1df7ed 100644
--- a/tests/unit_tests/mnemonics.cpp
+++ b/tests/unit_tests/mnemonics.cpp
@@ -27,6 +27,7 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "gtest/gtest.h"
+#include "common/exception.h"
#include "mnemonics/electrum-words.h"
#include "crypto/crypto.h"
#include <stdlib.h>
diff --git a/tests/unit_tests/test_protocol_pack.cpp b/tests/unit_tests/test_protocol_pack.cpp
index a9a1a34a6..1ff70b4d9 100644
--- a/tests/unit_tests/test_protocol_pack.cpp
+++ b/tests/unit_tests/test_protocol_pack.cpp
@@ -30,6 +30,7 @@
#include "gtest/gtest.h"
+#include "common/exception.h"
#include "include_base_utils.h"
#include "cryptonote_protocol/cryptonote_protocol_defs.h"
#include "storages/portable_storage_template_helper.h"