20#ifndef TEST_UNIT_TEST_MULTI_RUNNER_H
21#define TEST_UNIT_TEST_MULTI_RUNNER_H
23#include <xrpl/beast/unit_test/global_suites.h>
24#include <xrpl/beast/unit_test/runner.h>
26#include <boost/beast/core/static_string.hpp>
27#include <boost/container/static_vector.hpp>
28#include <boost/interprocess/ipc/message_queue.hpp>
29#include <boost/interprocess/mapped_region.hpp>
30#include <boost/interprocess/shared_memory_object.hpp>
31#include <boost/interprocess/sync/interprocess_mutex.hpp>
89 boost::container::static_vector<run_time, max_top>
top;
103template <
bool IsParent>
120 mutable boost::interprocess::interprocess_mutex
m_;
159 "RippledUnitTestMessageQueue";
286 template <
class Pred>
320 auto const num_tests =
suite.size();
325 if (cur_test_index >= num_tests)
327 auto iter =
suite.begin();
331 while (
auto t = get_test())
337 failed =
run(*t) || failed;
346 s <<
job_index_ <<
"> failed Unhandled exception in test.\n";
Unit test runner interface.
bool run(suite_info const &s)
Run the specified suite.
Associates a unit test type with metadata.
std::size_t suites() const
static constexpr char const * shared_mem_name_
std::size_t checkout_test_index()
void add(results const &r)
std::size_t get_keep_alive_count()
boost::interprocess::shared_memory_object shared_mem_
static constexpr char const * message_queue_name_
std::size_t tests() const
void inc_keep_alive_count()
boost::interprocess::mapped_region region_
void add_failures(std::size_t failures)
void message_queue_send(MessageType mt, std::string const &s)
std::unique_ptr< boost::interprocess::message_queue > message_queue_
std::size_t checkout_job_index()
A class to run a subset of unit tests.
multi_runner_child(multi_runner_child const &)=delete
virtual void on_log(std::string const &s) override
Called when a test logs output.
detail::case_results case_results_
virtual void on_case_end() override
Called when a new case ends.
std::thread keep_alive_thread_
bool run_multi(Pred pred)
multi_runner_child & operator=(multi_runner_child const &)=delete
detail::suite_results suite_results_
virtual void on_case_begin(std::string const &name) override
Called when a new case starts.
void add_failures(std::size_t failures)
virtual void on_suite_end() override
Called when a suite ends.
std::atomic< bool > continue_keep_alive_
virtual void on_suite_begin(beast::unit_test::suite_info const &info) override
Called when a new suite starts.
virtual void on_pass() override
Called for each passing condition.
virtual void on_fail(std::string const &reason) override
Called for each failing condition.
std::size_t suites() const
std::size_t tests() const
Manager for children running unit tests.
std::size_t tests() const
std::atomic< bool > continue_message_queue_
std::size_t suites() const
std::thread message_queue_thread_
void add_failures(std::size_t failures)
multi_runner_parent & operator=(multi_runner_parent const &)=delete
multi_runner_parent(multi_runner_parent const &)=delete
std::set< std::string > running_suites_
suite_list const & global_suites()
Holds test suites registered during static initialization.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
case_results(std::string name_="")
std::atomic< std::size_t > keep_alive_
std::size_t suites() const
std::size_t checkout_job_index()
std::atomic< std::size_t > job_index_
boost::interprocess::interprocess_mutex m_
void inc_keep_alive_count()
void add(results const &r)
std::atomic< bool > any_failed_
std::atomic< std::size_t > test_index_
std::size_t get_keep_alive_count()
std::size_t checkout_test_index()
std::size_t tests() const
void merge(results const &r)
boost::beast::static_string< 256 > static_string
void add(suite_results const &r)
boost::container::static_vector< run_time, max_top > top
clock_type::time_point start
void add(case_results const &r)
clock_type::time_point start
suite_results(std::string name_="")