aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-15 09:14:48 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-15 09:14:48 +0200
commit07c173498517ae82e823cc06f87e8b0787a5334a (patch)
tree66f34cfa2131a252fc4431989f5fd910f165e63f
parentMerge pull request #5392 (diff)
parenttests: add a few try/catch in main to shut coverity up (diff)
downloadmonero-07c173498517ae82e823cc06f87e8b0787a5334a.tar.xz
Merge pull request #5393
c5d3ea2f tests: add a few try/catch in main to shut coverity up (moneromooo-monero)
-rw-r--r--tests/difficulty/difficulty.cpp5
-rw-r--r--tests/hash-target.cpp3
-rw-r--r--tests/hash/main.cpp4
-rw-r--r--tests/libwallet_api_tests/main.cpp3
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);
}