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 3827 additions and 1034 deletions

View File

@@ -23,8 +23,8 @@
#include <xrpl/json/json_value.h>
#include <xrpl/protocol/ApiVersion.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <array>
#include <cassert>
#include <concepts>
#include <cstdlib>
#include <functional>
@@ -159,8 +159,10 @@ struct MultiApiJson
-> std::
invoke_result_t<Fn, decltype(json.val[0]), Version, Args&&...>
{
assert(
valid(version) && index(version) >= 0 && index(version) < size);
ASSERT(
valid(version) && index(version) >= 0 && index(version) < size,
"ripple::detail::MultiApiJson::operator<Args...>() : valid "
"version");
return std::invoke(
fn,
json.val[index(version)],
@@ -177,8 +179,9 @@ struct MultiApiJson
operator()(Json& json, Version version, Fn fn) const
-> std::invoke_result_t<Fn, decltype(json.val[0])>
{
assert(
valid(version) && index(version) >= 0 && index(version) < size);
ASSERT(
valid(version) && index(version) >= 0 && index(version) < size,
"ripple::detail::MultiApiJson::operator() : valid version");
return std::invoke(fn, json.val[index(version)]);
}
} visitor = {};