Add Antithesis intrumentation (#5042)

* Copy Antithesis SDK version 0.4.0 to directory external/
* Add build option `voidstar` to enable instrumentation with Antithesis SDK
* Define instrumentation macros ASSERT and UNREACHABLE in terms of regular C assert
* Replace asserts with named ASSERT or UNREACHABLE
* Add UNREACHABLE to LogicError
* Document instrumentation macros in CONTRIBUTING.md
This commit is contained in:
Bronek Kozicki
2024-12-03 14:52:21 -05:00
committed by Ed Hennis
parent f64cf9187a
commit d7e949193f
261 changed files with 3848 additions and 1034 deletions

View File

@@ -17,10 +17,10 @@
*/
//==============================================================================
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/resource/Consumer.h>
#include <xrpl/resource/detail/Entry.h>
#include <xrpl/resource/detail/Logic.h>
#include <cassert>
namespace ripple {
namespace Resource {
@@ -109,14 +109,18 @@ Consumer::charge(Charge const& what)
bool
Consumer::warn()
{
assert(m_entry != nullptr);
ASSERT(
m_entry != nullptr,
"ripple::Resource::Consumer::warn : non-null entry");
return m_logic->warn(*m_entry);
}
bool
Consumer::disconnect(beast::Journal const& j)
{
assert(m_entry != nullptr);
ASSERT(
m_entry != nullptr,
"ripple::Resource::Consumer::disconnect : non-null entry");
bool const d = m_logic->disconnect(*m_entry);
if (d)
{
@@ -128,14 +132,18 @@ Consumer::disconnect(beast::Journal const& j)
int
Consumer::balance()
{
assert(m_entry != nullptr);
ASSERT(
m_entry != nullptr,
"ripple::Resource::Consumer::balance : non-null entry");
return m_logic->balance(*m_entry);
}
Entry&
Consumer::entry()
{
assert(m_entry != nullptr);
ASSERT(
m_entry != nullptr,
"ripple::Resource::Consumer::entry : non-null entry");
return *m_entry;
}