1#ifndef TEST_UNIT_TEST_MULTI_RUNNER_H
2#define TEST_UNIT_TEST_MULTI_RUNNER_H
4#include <xrpl/beast/unit_test/global_suites.h>
5#include <xrpl/beast/unit_test/runner.h>
7#include <boost/beast/core/static_string.hpp>
8#include <boost/container/static_vector.hpp>
9#include <boost/interprocess/ipc/message_queue.hpp>
10#include <boost/interprocess/mapped_region.hpp>
11#include <boost/interprocess/shared_memory_object.hpp>
12#include <boost/interprocess/sync/interprocess_mutex.hpp>
69 boost::container::static_vector<run_time, max_top>
top;
83template <
bool IsParent>
100 mutable boost::interprocess::interprocess_mutex
m_;
139 "RippledUnitTestMessageQueue";
268 template <
class Pred>
302 auto const num_tests =
suite.size();
307 if (cur_test_index >= num_tests)
309 auto iter =
suite.begin();
313 while (
auto t = get_test())
319 failed =
run(*t) || failed;
328 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::unique_ptr< boost::interprocess::message_queue > message_queue_
static constexpr char const * message_queue_name_
void message_queue_send(MessageType mt, std::string const &s)
boost::interprocess::mapped_region region_
void add_failures(std::size_t failures)
static constexpr char const * shared_mem_name_
void add(results const &r)
std::size_t checkout_job_index()
boost::interprocess::shared_memory_object shared_mem_
std::size_t checkout_test_index()
std::size_t suites() const
std::size_t get_keep_alive_count()
std::size_t tests() const
void inc_keep_alive_count()
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_="")
boost::interprocess::interprocess_mutex m_
std::size_t suites() const
std::atomic< bool > any_failed_
void inc_keep_alive_count()
std::atomic< std::size_t > keep_alive_
std::atomic< std::size_t > test_index_
std::atomic< std::size_t > job_index_
void add(results const &r)
std::size_t checkout_test_index()
std::size_t checkout_job_index()
std::size_t tests() const
std::size_t get_keep_alive_count()
void add(suite_results const &r)
boost::beast::static_string< 256 > static_string
boost::container::static_vector< run_time, max_top > top
clock_type::time_point start
void merge(results const &r)
void add(case_results const &r)
clock_type::time_point start
suite_results(std::string name_="")