Skip to content

Commit

Permalink
add monero_tests.cpp with multisig stress test
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Sep 1, 2023
1 parent 14607a2 commit 24a39aa
Show file tree
Hide file tree
Showing 4 changed files with 526 additions and 1 deletion.
52 changes: 52 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ project(MoneroCppLibrary)
set(BUILD_LIBRARY ON)
set(BUILD_SAMPLE ON)
set(BUILD_SCRATCHPAD ON)
set(BUILD_TESTS ON)

###################
# monero-project
Expand Down Expand Up @@ -457,3 +458,54 @@ if (BUILD_SCRATCHPAD)
target_link_libraries(scratchpad dl)
endif()
endif()

########################
# Build C++ tests
########################

if (BUILD_TESTS)
set(TEST_SRC_FILES test/monero_tests.cpp)

add_executable(monero_tests ${LIBRARY_SRC_FILES} ${TEST_SRC_FILES})

target_link_libraries(monero_tests
wallet
rpc_base
net
lmdb
easylogging
cryptonote_core
cryptonote_protocol
cryptonote_basic
cryptonote_format_utils_basic
mnemonics
ringct
ringct_basic
common
cncrypto
blockchain_db
blocks
checkpoints
device
device_trezor
multisig
version
randomx
epee
hardforks
cncrypto
${wallet_crypto}

${UNBOUND_LIBRARIES}
${Boost_LIBRARIES}
${Protobuf_LIBRARY}
${LibUSB_LIBRARIES}
${OPENSSL_LIBRARIES}
${SODIUM_LIBRARY}
${HIDAPI_LIBRARIES}
${EXTRA_LIBRARIES}
)
if (NOT WIN32)
target_link_libraries(monero_tests dl)
endif()
endif()
25 changes: 25 additions & 0 deletions src/utils/gen_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
#define gen_utils_h

#include <boost/lexical_cast.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <chrono>
#include "include_base_utils.h"
#include "common/util.h"

Expand All @@ -63,6 +67,27 @@
*/
namespace gen_utils
{

/**
* Return a unique identifier.
*
* @return a unique id
*/
static std::string get_uuid() {
boost::uuids::random_generator generator;
boost::uuids::uuid uuid = generator();
return boost::uuids::to_string(uuid);
}

/**
* Wait for the given duration.
*
* @param duration_ms the duration to wait in milliseconds
*/
static void wait_for(uint64_t duration_ms) {
std::this_thread::sleep_for(std::chrono::milliseconds(duration_ms));
}

// ------------------------- VALUE RECONCILATION ----------------------------

// TODO: refactor common template code
Expand Down

0 comments on commit 24a39aa

Please sign in to comment.