Merge pull request #5393

c5d3ea2f tests: add a few try/catch in main to shut coverity up (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2019-04-15 09:14:48 +02:00
commit 07c1734985
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
4 changed files with 15 additions and 0 deletions

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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))

View file

@ -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);
}