diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-03 16:15:55 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-03 16:24:09 +0000 |
commit | c5d3ea2fef779f0e937237b4a65912f5da7123bb (patch) | |
tree | daec393a7daaa9cc6ee1f8f07f12909bcb0417b7 /tests | |
parent | Merge pull request #5387 (diff) | |
download | monero-c5d3ea2fef779f0e937237b4a65912f5da7123bb.tar.xz |
tests: add a few try/catch in main to shut coverity up
Diffstat (limited to 'tests')
-rw-r--r-- | tests/difficulty/difficulty.cpp | 5 | ||||
-rw-r--r-- | tests/hash-target.cpp | 3 | ||||
-rw-r--r-- | tests/hash/main.cpp | 4 | ||||
-rw-r--r-- | tests/libwallet_api_tests/main.cpp | 3 |
4 files changed, 15 insertions, 0 deletions
diff --git a/tests/difficulty/difficulty.cpp b/tests/difficulty/difficulty.cpp index 9985b8710..11ce0bd73 100644 --- a/tests/difficulty/difficulty.cpp +++ b/tests/difficulty/difficulty.cpp @@ -36,6 +36,7 @@ #include <algorithm> #include <stdexcept> +#include "misc_log_ex.h" #include "cryptonote_config.h" #include "cryptonote_basic/difficulty.h" @@ -82,6 +83,8 @@ static int test_wide_difficulty(const char *filename) } int main(int argc, char *argv[]) { + TRY_ENTRY(); + if (argc < 2) { cerr << "Wrong arguments" << endl; return 1; @@ -136,4 +139,6 @@ int main(int argc, char *argv[]) { data.clear(fstream::badbit); } return 0; + + CATCH_ENTRY_L0("main", 1); } diff --git a/tests/hash-target.cpp b/tests/hash-target.cpp index 12acc5a67..1e988c302 100644 --- a/tests/hash-target.cpp +++ b/tests/hash-target.cpp @@ -32,6 +32,7 @@ #include <cstdlib> #include <cstring> #include <limits> +#include "misc_log_ex.h" #include "crypto/hash.h" #include "cryptonote_basic/difficulty.h" @@ -39,6 +40,7 @@ using namespace std; using cryptonote::check_hash; int main(int argc, char *argv[]) { + TRY_ENTRY(); crypto::hash h; for (cryptonote::difficulty_type diff = 1;; diff += 1 + (diff >> 8)) { for (uint16_t b = 0; b < 256; b++) { @@ -83,4 +85,5 @@ int main(int argc, char *argv[]) { } } return 0; + CATCH_ENTRY_L0("main", 1); } diff --git a/tests/hash/main.cpp b/tests/hash/main.cpp index adf1bd9c4..d62098a60 100644 --- a/tests/hash/main.cpp +++ b/tests/hash/main.cpp @@ -35,6 +35,7 @@ #include <string> #include <cfenv> +#include "misc_log_ex.h" #include "warnings.h" #include "crypto/hash.h" #include "crypto/variant2_int_sqrt.h" @@ -89,6 +90,8 @@ int test_variant2_int_sqrt(); int test_variant2_int_sqrt_ref(); int main(int argc, char *argv[]) { + TRY_ENTRY(); + hash_f *f; hash_func *hf; fstream input; @@ -183,6 +186,7 @@ int main(int argc, char *argv[]) { } } return error ? 1 : 0; + CATCH_ENTRY_L0("main", 1); } #if defined(__x86_64__) || (defined(_MSC_VER) && defined(_WIN64)) diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp index 02faae50d..c34da04b7 100644 --- a/tests/libwallet_api_tests/main.cpp +++ b/tests/libwallet_api_tests/main.cpp @@ -1139,6 +1139,8 @@ TEST_F(WalletManagerMainnetTest, RecoverAndRefreshWalletMainNetAsync) int main(int argc, char** argv) { + TRY_ENTRY(); + tools::on_startup(); // we can override default values for "TESTNET_DAEMON_ADDRESS" and "WALLETS_ROOT_DIR" @@ -1173,4 +1175,5 @@ int main(int argc, char** argv) ::testing::InitGoogleTest(&argc, argv); Monero::WalletManagerFactory::setLogLevel(Monero::WalletManagerFactory::LogLevel_Max); return RUN_ALL_TESTS(); + CATCH_ENTRY_L0("main", 1); } |