Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
// Copyrights(c) 2017-2021, The Electroneum Project
2
// Copyrights(c) 2014-2019, The Monero Project
3
//
4
// All rights reserved.
5
//
6
// Redistribution and use in source and binary forms, with or without modification, are
7
// permitted provided that the following conditions are met:
8
//
9
// 1. Redistributions of source code must retain the above copyright notice, this list of
10
// conditions and the following disclaimer.
11
//
12
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
13
// of conditions and the following disclaimer in the documentation and/or other
14
// materials provided with the distribution.
15
//
16
// 3. Neither the name of the copyright holder nor the names of its contributors may be
17
// used to endorse or promote products derived from this software without specific
18
// prior written permission.
19
//
20
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
21
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
28
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
//
30
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
31
32
#include "gtest/gtest.h"
33
34
#include <boost/filesystem/path.hpp>
35
#include <boost/filesystem/operations.hpp>
36
#include <boost/program_options.hpp>
37
38
#include "
p2p/net_node.h
"
39
#include "p2p/net_node.inl"
40
#include "
cryptonote_protocol/cryptonote_protocol_handler.h
"
41
#include "cryptonote_protocol/cryptonote_protocol_handler.inl"
42
#include "
include_base_utils.h
"
43
#include "
string_tools.h
"
44
#include "
common/command_line.h
"
45
#include "
common/util.h
"
46
#include "
unit_tests_utils.h
"
47
48
namespace
po = boost::program_options;
49
50
boost::filesystem::path
unit_test::data_dir
;
51
52
namespace
nodetool
{
template
class
node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core>>; }
53
namespace
cryptonote
{
template
class
t_cryptonote_protocol_handler<cryptonote::core>; }
54
55
int
main
(
int
argc,
char
** argv)
56
{
57
TRY_ENTRY
();
58
59
tools::on_startup
();
60
epee::string_tools::set_module_name_and_folder
(argv[0]);
61
mlog_configure
(
mlog_get_default_log_path
(
"unit_tests.log"
),
true
);
62
epee::debug::get_set_enable_assert
(
true
,
false
);
63
64
::testing::InitGoogleTest
(&argc, argv);
65
66
po::options_description desc_options(
"Command line options"
);
67
const
command_line::arg_descriptor<std::string>
arg_data_dir = {
"data-dir"
,
"Data files directory"
, DEFAULT_DATA_DIR };
68
command_line::add_arg
(desc_options, arg_data_dir);
69
70
po::variables_map vm;
71
bool
r =
command_line::handle_error_helper
(desc_options, [&]()
72
{
73
po::store(po::parse_command_line(argc, argv, desc_options), vm);
74
po::notify(vm);
75
return
true
;
76
});
77
if
(! r)
78
return
1;
79
80
unit_test::data_dir
=
command_line::get_arg
(vm, arg_data_dir);
81
82
CATCH_ENTRY_L0
(
"main"
, 1);
83
84
return
RUN_ALL_TESTS
();
85
}
main
int main()
Definition
archivertest.cpp:283
command_line.h
cryptonote_protocol_handler.h
This is the orginal cryptonote protocol network-events handler, modified by us.
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition
gtest.h:2232
include_base_utils.h
mlog_configure
void mlog_configure(const std::string &filename_base, bool console, const std::size_t max_log_file_size=MAX_LOG_FILE_SIZE, const std::size_t max_log_files=MAX_LOG_FILES)
Definition
mlog.cpp:148
mlog_get_default_log_path
std::string mlog_get_default_log_path(const char *default_filename)
Definition
mlog.cpp:72
CATCH_ENTRY_L0
#define CATCH_ENTRY_L0(lacation, return_val)
Definition
misc_log_ex.h:165
TRY_ENTRY
#define TRY_ENTRY()
Definition
misc_log_ex.h:151
command_line::add_arg
void add_arg(boost::program_options::options_description &description, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg, bool unique=true)
Definition
command_line.h:188
command_line::handle_error_helper
bool handle_error_helper(const boost::program_options::options_description &desc, F parser)
Definition
command_line.h:237
command_line::get_arg
T get_arg(const boost::program_options::variables_map &vm, const arg_descriptor< T, false, true > &arg)
Definition
command_line.h:271
cryptonote
Holds cryptonote related classes and helpers.
Definition
ban.cpp:40
epee::debug::get_set_enable_assert
bool get_set_enable_assert(bool set=false, bool v=false)
Definition
misc_log_ex.h:138
epee::string_tools::set_module_name_and_folder
bool set_module_name_and_folder(const std::string &path_to_process_)
Definition
string_tools.h:249
nodetool
Definition
ban.cpp:215
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
tools::on_startup
bool on_startup()
Definition
util.cpp:778
unit_test::data_dir
boost::filesystem::path data_dir
Definition
main.cpp:50
net_node.h
util.h
string_tools.h
command_line::arg_descriptor
Definition
command_line.h:54
unit_tests_utils.h
tests
unit_tests
main.cpp
Generated on
for Electroneum by
1.17.0