Compare commits

...

4 Commits

Author SHA1 Message Date
Richard Holland
c894633b6f re-enable ocm 2026-10-05 16:45:06 +11:00
tequ
2baa23d14b Fix/string plus int warning (#857) 2026-10-05 15:03:40 +10:00
tequ
de9d5e53f1 test: cover BuildInfo::getVersionString (#856)
Add a unit test for getVersionString() / getFullVersionString() so the
generated "<year>.<month>.<day>-CustomBuild" version string is checked
for strict semver round-trip and sane date ranges before touching the
__DATE__ parsing code.
2026-10-05 14:39:12 +10:00
tequ
80c70ec03d Add fix20261005 Amendment placeholder (#860) 2026-10-05 14:08:57 +10:00
4 changed files with 56 additions and 18 deletions

View File

@@ -34,10 +34,11 @@
// If you add an amendment here, then do not forget to increment `numFeatures`
// in include/xrpl/protocol/Feature.h.
XRPL_FIX (20261005, Supported::yes, VoteBehavior::DefaultYes)
XRPL_FEATURE(EscrowDestinationCancel, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (20260929, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(HookOnV2_1, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(OnChainManifests, Supported::no, VoteBehavior::DefaultNo)
XRPL_FEATURE(OnChainManifests, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (HookMap, Supported::yes, VoteBehavior::DefaultYes)
XRPL_FIX (GuardDepth32, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(NamedHooks, Supported::yes, VoteBehavior::DefaultNo)

View File

@@ -56,9 +56,9 @@ getVersionString()
(versionString == std::string("0.") + std::string("0.0") ||
versionString == std::string("0.0.0+DEBUG")))
{
std::string y = std::string(__DATE__ + 7);
std::string y = std::string(&__DATE__[7]);
std::string d = std::string(
__DATE__ + 4 + (__DATE__[4] == ' ' ? 1 : 0),
&__DATE__[4 + (__DATE__[4] == ' ' ? 1 : 0)],
__DATE__[4] == ' ' ? 1 : 2);
std::string m;
switch (__DATE__[0])

View File

@@ -798,21 +798,18 @@ public:
void
run() override
{
// RH TODO: re-add these when the amendment is ready for supported::yes
/*
using namespace test::jtx;
auto const sa = supported_amendments();
testSubmission(sa);
testUpdate(sa);
testRevocation(sa);
testRetrieval(sa);
testSigningKeyRetrieval(sa);
testMalformed(sa);
testEnvelopeRejections(sa);
testCorruptLedger(sa);
testGossipSelection(sa);
testDisabled(sa);
*/
using namespace test::jtx;
auto const sa = supported_amendments();
testSubmission(sa);
testUpdate(sa);
testRevocation(sa);
testRetrieval(sa);
testSigningKeyRetrieval(sa);
testMalformed(sa);
testEnvelopeRejections(sa);
testCorruptLedger(sa);
testGossipSelection(sa);
testDisabled(sa);
}
};

View File

@@ -17,6 +17,7 @@
*/
//==============================================================================
#include <xrpl/beast/core/SemanticVersion.h>
#include <xrpl/beast/unit_test.h>
#include <xrpl/protocol/BuildInfo.h>
@@ -25,6 +26,44 @@ namespace ripple {
class BuildInfo_test : public beast::unit_test::suite
{
public:
void
testGetVersionString()
{
testcase("GetVersionString");
auto const& s = BuildInfo::getVersionString();
BEAST_EXPECT(!s.empty());
// Same reference on every call (static cache).
BEAST_EXPECT(&BuildInfo::getVersionString() == &s);
// Must be strict semver and round-trip unchanged (no leading
// zeros, no stray whitespace).
beast::SemanticVersion v;
BEAST_EXPECT(v.parse(s));
BEAST_EXPECT(v.print() == s);
BEAST_EXPECT(BuildInfo::getFullVersionString() == "xahaud-" + s);
if (s.find("-CustomBuild") == std::string::npos)
return;
// Version generated from __DATE__ ("Mmm dd yyyy"):
// <year>.<month>.<day>-CustomBuild[+DEBUG]
BEAST_EXPECT(v.majorVersion >= 2023 && v.majorVersion <= 9999);
BEAST_EXPECT(v.minorVersion >= 1 && v.minorVersion <= 12);
BEAST_EXPECT(v.patchVersion >= 1 && v.patchVersion <= 31);
BEAST_EXPECT(
v.preReleaseIdentifiers ==
beast::SemanticVersion::identifier_list{"CustomBuild"});
#ifdef DEBUG
BEAST_EXPECT(
v.metaData == beast::SemanticVersion::identifier_list{"DEBUG"});
#else
BEAST_EXPECT(v.metaData.empty());
#endif
}
void
testEncodeSoftwareVersion()
{
@@ -119,6 +158,7 @@ public:
void
run() override
{
testGetVersionString();
testEncodeSoftwareVersion();
testIsRippledVersion();
testIsNewerVersion();