From a9c3bb84ba4673284ac8f9388a12064b8373e902 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 28 Jan 2026 15:30:05 +0000 Subject: [PATCH] fixes to Number. run et even when st fails Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- .github/workflows/reusable-build-test-config.yml | 11 ++++++++++- include/xrpl/protocol/ErrorCodes.h | 6 +++--- src/libxrpl/basics/Number.cpp | 13 +++++++------ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index e2a2be9cec..9f1b78f79a 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -211,8 +211,12 @@ jobs: echo "LSAN_OPTIONS=include=${GITHUB_WORKSPACE}/sanitizers/suppressions/runtime-lsan-options.txt:suppressions=${GITHUB_WORKSPACE}/sanitizers/suppressions/lsan.supp" >> ${GITHUB_ENV} - name: Run the separate tests + # We continue on error here because we want to try the Embedded tests before + # failing. This will give us details on all the failures at once. + continue-on-error: true if: ${{ !inputs.build_only }} working-directory: ${{ env.BUILD_DIR }} + id: separate_tests # Windows locks some of the build files while running tests, and parallel jobs can collide env: BUILD_TYPE: ${{ inputs.build_type }} @@ -224,13 +228,18 @@ jobs: -j "${PARALLELISM}" - name: Run the embedded tests - if: ${{ always() && !inputs.build_only }} + if: ${{ !inputs.build_only }} working-directory: ${{ runner.os == 'Windows' && format('{0}/{1}', env.BUILD_DIR, inputs.build_type) || env.BUILD_DIR }} env: BUILD_NPROC: ${{ steps.nproc.outputs.nproc }} run: | ./xrpld --unittest --unittest-jobs "${BUILD_NPROC}" + # Pipeline should fail if the separate tests failed. + - name: Check results of the SeparateTests + if: ${{ !inputs.build_only && steps.separate_tests.outcome == 'failure' }} + run: exit 1 + - name: Debug failure (Linux) if: ${{ failure() && runner.os == 'Linux' && !inputs.build_only }} run: | diff --git a/include/xrpl/protocol/ErrorCodes.h b/include/xrpl/protocol/ErrorCodes.h index 874d2d9b69..3a2645347a 100644 --- a/include/xrpl/protocol/ErrorCodes.h +++ b/include/xrpl/protocol/ErrorCodes.h @@ -253,7 +253,7 @@ missing_field_error(Json::StaticString name) inline std::string object_field_message(std::string const& name) { - return {"Invalid field '" + name + "', not object."}; + return "Invalid field '" + name + "', not object."; } inline Json::Value @@ -271,7 +271,7 @@ object_field_error(Json::StaticString name) inline std::string invalid_field_message(std::string const& name) { - return {"Invalid field '" + name + "'."}; + return "Invalid field '" + name + "'."; } inline std::string @@ -295,7 +295,7 @@ invalid_field_error(Json::StaticString name) inline std::string expected_field_message(std::string const& name, std::string const& type) { - return {"Invalid field '" + name + "', not " + type + "."}; + return "Invalid field '" + name + "', not " + type + "."; } inline std::string diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index 02de174e08..983ca00fe6 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -109,7 +110,7 @@ public: int& exponent, internalrep const& minMantissa, internalrep const& maxMantissa, - std::string location); + std::string_view location); // Modify the result to the correctly rounded value template @@ -122,7 +123,7 @@ public: // Modify the result to the correctly rounded value void - doRound(rep& drops, std::string location); + doRound(rep& drops, std::string_view location); private: void @@ -252,7 +253,7 @@ Number::Guard::doRoundUp( int& exponent, internalrep const& minMantissa, internalrep const& maxMantissa, - std::string location) + std::string_view location) { auto r = round(); if (r == 1 || (r == 0 && (mantissa & 1) == 1)) @@ -268,7 +269,7 @@ Number::Guard::doRoundUp( } bringIntoRange(negative, mantissa, exponent, minMantissa); if (exponent > maxExponent) - Throw(location); + Throw(std::string(location)); } template @@ -294,7 +295,7 @@ Number::Guard::doRoundDown( // Modify the result to the correctly rounded value void -Number::Guard::doRound(rep& drops, std::string location) +Number::Guard::doRound(rep& drops, std::string_view location) { auto r = round(); if (r == 1 || (r == 0 && (drops & 1) == 1)) @@ -308,7 +309,7 @@ Number::Guard::doRound(rep& drops, std::string location) // or "(maxRep + 1) / 10", neither of which will round up when // converting to rep, though the latter might overflow _before_ // rounding. - throw std::overflow_error(location); // LCOV_EXCL_LINE + throw std::overflow_error(std::string(location)); // LCOV_EXCL_LINE } ++drops; }