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,9 @@
*/
//==============================================================================
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/protocol/STBase.h>
#include <boost/checked_delete.hpp>
#include <cassert>
#include <memory>
namespace ripple {
@@ -30,7 +29,7 @@ STBase::STBase() : fName(&sfGeneric)
STBase::STBase(SField const& n) : fName(&n)
{
assert(fName);
ASSERT(fName != nullptr, "ripple::STBase::STBase : field is set");
}
STBase&
@@ -106,13 +105,15 @@ void
STBase::add(Serializer& s) const
{
// Should never be called
assert(false);
UNREACHABLE("ripple::STBase::add : not implemented");
}
bool
STBase::isEquivalent(const STBase& t) const
{
assert(getSType() == STI_NOTPRESENT);
ASSERT(
getSType() == STI_NOTPRESENT,
"ripple::STBase::isEquivalent : type not present");
return t.getSType() == STI_NOTPRESENT;
}
@@ -126,7 +127,7 @@ void
STBase::setFName(SField const& n)
{
fName = &n;
assert(fName);
ASSERT(fName != nullptr, "ripple::STBase::setFName : field is set");
}
SField const&
@@ -138,7 +139,7 @@ STBase::getFName() const
void
STBase::addFieldID(Serializer& s) const
{
assert(fName->isBinary());
ASSERT(fName->isBinary(), "ripple::STBase::addFieldID : field is binary");
s.addFieldID(fName->fieldType, fName->fieldValue);
}