Compare commits

..

3 Commits

Author SHA1 Message Date
Michael Legleux
8585055d6e fix output 2026-02-27 17:20:40 -08:00
Michael Legleux
a35308399d readable ui output 2026-02-27 17:16:57 -08:00
Michael Legleux
8068a7b513 Trigger run 2026-02-27 15:57:17 -08:00
32 changed files with 115 additions and 72 deletions

View File

@@ -10,7 +10,6 @@ Checks: "-*,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-empty-catch,
bugprone-fold-init-type,
bugprone-forward-declaration-namespace,
bugprone-inaccurate-erase,
@@ -84,6 +83,7 @@ Checks: "-*,
# ---
# checks that have some issues that need to be resolved:
#
# bugprone-empty-catch,
# bugprone-crtp-constructor-accessibility,
# bugprone-inc-dec-in-conditions,
# bugprone-reserved-identifier,

View File

@@ -32,10 +32,13 @@ We will further set additional CMake arguments as follows:
"""
def generate_strategy_matrix(all: bool, config: Config) -> list:
def generate_strategy_matrix(all: bool, config: Config, distro: str = "") -> list:
configurations = []
os_entries = config.os
if distro:
os_entries = [o for o in os_entries if o["distro_name"] == distro]
for architecture, os, build_type, cmake_args in itertools.product(
config.architecture, config.os, config.build_type, config.cmake_args
config.architecture, os_entries, config.build_type, config.cmake_args
):
# The default CMake target is 'all' for Linux and MacOS and 'install'
# for Windows, but it can get overridden for certain configurations.
@@ -223,7 +226,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
if (n := os["compiler_version"]) != "":
config_name += f"-{n}"
config_name += (
f"-{architecture['platform'][architecture['platform'].find('/')+1:]}"
f"-{architecture['platform'][architecture['platform'].find('/') + 1 :]}"
)
config_name += f"-{build_type.lower()}"
if "-Dcoverage=ON" in cmake_args:
@@ -313,21 +316,32 @@ if __name__ == "__main__":
required=False,
type=Path,
)
parser.add_argument(
"-d",
"--distro",
help="Filter OS entries to only include those with this distro_name (e.g. 'debian', 'rhel', 'ubuntu').",
required=False,
type=str,
default="",
)
args = parser.parse_args()
matrix = []
if args.config is None or args.config == "":
matrix += generate_strategy_matrix(
args.all, read_config(THIS_DIR / "linux.json")
args.all, read_config(THIS_DIR / "linux.json"), args.distro
)
matrix += generate_strategy_matrix(
args.all, read_config(THIS_DIR / "macos.json")
args.all, read_config(THIS_DIR / "macos.json"), args.distro
)
matrix += generate_strategy_matrix(
args.all, read_config(THIS_DIR / "windows.json")
args.all, read_config(THIS_DIR / "windows.json"), args.distro
)
else:
matrix += generate_strategy_matrix(args.all, read_config(args.config))
matrix += generate_strategy_matrix(
args.all, read_config(args.config), args.distro
)
# Generate the strategy matrix.
print(f"matrix={json.dumps({'include': matrix})}")
# print(json.dumps(matrix, indent=2))

View File

@@ -128,12 +128,23 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [linux, macos, windows]
include:
- os: linux
distro: debian
- os: linux
distro: rhel
- os: linux
distro: ubuntu
- os: macos
distro: ""
- os: windows
distro: ""
with:
# Enable ccache only for events targeting the XRPLF repository, since
# other accounts will not have access to our remote cache storage.
ccache_enabled: ${{ github.repository_owner == 'XRPLF' }}
os: ${{ matrix.os }}
distro: ${{ matrix.distro }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -77,7 +77,17 @@ jobs:
strategy:
fail-fast: ${{ github.event_name == 'merge_group' }}
matrix:
os: [linux, macos, windows]
include:
- os: linux
distro: debian
- os: linux
distro: rhel
- os: linux
distro: ubuntu
- os: macos
distro: ""
- os: windows
distro: ""
with:
# Enable ccache only for events targeting the XRPLF repository, since
# other accounts will not have access to our remote cache storage.
@@ -86,6 +96,7 @@ jobs:
# not identical to a regular compilation.
ccache_enabled: ${{ github.repository_owner == 'XRPLF' && !startsWith(github.ref, 'refs/heads/release') }}
os: ${{ matrix.os }}
distro: ${{ matrix.distro }}
strategy_matrix: ${{ github.event_name == 'schedule' && 'all' || 'minimal' }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -26,6 +26,12 @@ on:
type: string
default: "minimal"
distro:
description: 'Filter to only include configs for this distro (e.g. "debian", "rhel", "ubuntu"). Leave empty for no filtering.'
required: false
type: string
default: ""
secrets:
CODECOV_TOKEN:
description: "The Codecov token to use for uploading coverage reports."
@@ -38,9 +44,11 @@ jobs:
with:
os: ${{ inputs.os }}
strategy_matrix: ${{ inputs.strategy_matrix }}
distro: ${{ inputs.distro }}
# Build and test the binary for each configuration.
build-test-config:
name: ${{ matrix.config_name }}
needs:
- generate-matrix
uses: ./.github/workflows/reusable-build-test-config.yml

View File

@@ -13,6 +13,11 @@ on:
required: false
type: string
default: "minimal"
distro:
description: 'Filter to only include configs for this distro (e.g. "debian", "rhel", "ubuntu"). Leave empty for no filtering.'
required: false
type: string
default: ""
outputs:
matrix:
description: "The generated strategy matrix."
@@ -42,4 +47,5 @@ jobs:
env:
GENERATE_CONFIG: ${{ inputs.os != '' && format('--config={0}.json', inputs.os) || '' }}
GENERATE_OPTION: ${{ inputs.strategy_matrix == 'all' && '--all' || '' }}
run: ./generate.py ${GENERATE_OPTION} ${GENERATE_CONFIG} >> "${GITHUB_OUTPUT}"
GENERATE_DISTRO: ${{ inputs.distro != '' && format('--distro={0}', inputs.distro) || '' }}
run: ./generate.py ${GENERATE_OPTION} ${GENERATE_CONFIG} ${GENERATE_DISTRO} >> "${GITHUB_OUTPUT}"

View File

@@ -176,8 +176,6 @@ words:
- nixfmt
- nixos
- nixpkgs
- NOLINT
- NOLINTNEXTLINE
- nonxrp
- noripple
- nudb

View File

@@ -10,7 +10,6 @@
#include <cctype>
#include <iterator>
#include <string>
#include <string_view>
#include <vector>
namespace beast {
@@ -182,7 +181,7 @@ split_commas(FwdIt first, FwdIt last)
template <class Result = std::vector<std::string>>
Result
split_commas(std::string_view const& s)
split_commas(boost::beast::string_view const& s)
{
return split_commas(s.begin(), s.end());
}

View File

@@ -1,19 +1,20 @@
#pragma once
#include <boost/beast/core/string.hpp>
#include <functional>
#include <string>
#include <string_view>
namespace Json {
class Value;
using Output = std::function<void(std::string_view const&)>;
using Output = std::function<void(boost::beast::string_view const&)>;
inline Output
stringOutput(std::string& s)
{
return [&](std::string_view const& b) { s.append(b.data(), b.size()); };
return [&](boost::beast::string_view const& b) { s.append(b.data(), b.size()); };
}
/** Writes a minimal representation of a Json value to an Output in O(n) time.

View File

@@ -17,7 +17,6 @@
#include <functional>
#include <list>
#include <string_view>
namespace xrpl {
@@ -49,7 +48,8 @@ private:
bool ping_active_ = false;
boost::beast::websocket::ping_data payload_;
error_code ec_;
std::function<void(boost::beast::websocket::frame_type, std::string_view)> control_callback_;
std::function<void(boost::beast::websocket::frame_type, boost::beast::string_view)>
control_callback_;
public:
template <class Body, class Headers>
@@ -137,7 +137,7 @@ protected:
on_ping(error_code const& ec);
void
on_ping_pong(boost::beast::websocket::frame_type kind, std::string_view payload);
on_ping_pong(boost::beast::websocket::frame_type kind, boost::beast::string_view payload);
void
on_timer(error_code ec);
@@ -414,11 +414,11 @@ template <class Handler, class Impl>
void
BaseWSPeer<Handler, Impl>::on_ping_pong(
boost::beast::websocket::frame_type kind,
std::string_view payload)
boost::beast::string_view payload)
{
if (kind == boost::beast::websocket::frame_type::pong)
{
std::string_view p(payload_.begin(), payload_.size());
boost::beast::string_view p(payload_.begin());
if (payload == p)
{
close_on_timer_ = false;

View File

@@ -249,7 +249,7 @@ public:
{
m_timer.cancel();
}
catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch)
catch (boost::system::system_error const&)
{
// ignored
}

View File

@@ -8,7 +8,6 @@
#include <set>
#include <stack>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@@ -88,14 +87,14 @@ public:
}
void
output(std::string_view const& bytes)
output(boost::beast::string_view const& bytes)
{
markStarted();
output_(bytes);
}
void
stringOutput(std::string_view const& bytes)
stringOutput(boost::beast::string_view const& bytes)
{
markStarted();
std::size_t position = 0, writtenUntil = 0;

View File

@@ -83,7 +83,7 @@ public:
// close can throw and we don't want the destructor to throw.
close();
}
catch (nudb::system_error const&) // NOLINT(bugprone-empty-catch)
catch (nudb::system_error const&)
{
// Don't allow exceptions to propagate out of destructors.
// close() has already logged the error.

View File

@@ -443,7 +443,6 @@ getRate(STAmount const& offerOut, STAmount const& offerIn)
{
if (offerOut == beast::zero)
return 0;
try
{
STAmount r = divide(offerIn, offerOut, noIssue());
@@ -455,11 +454,12 @@ getRate(STAmount const& offerOut, STAmount const& offerIn)
std::uint64_t ret = r.exponent() + 100;
return (ret << (64 - 8)) | r.mantissa();
}
catch (...)
catch (std::exception const&)
{
// overflow -- very bad offer
return 0;
}
// overflow -- very bad offer
return 0;
}
/**

View File

@@ -246,10 +246,10 @@ STTx::checkSign(Rules const& rules, STObject const& sigObject) const
return signingPubKey.empty() ? checkMultiSign(rules, sigObject)
: checkSingleSign(sigObject);
}
catch (...)
catch (std::exception const&)
{
return Unexpected("Internal signature check failure.");
}
return Unexpected("Internal signature check failure.");
}
Expected<void, std::string>

View File

@@ -1126,8 +1126,8 @@ toClaim(STTx const& tx)
}
catch (...)
{
return std::nullopt;
}
return std::nullopt;
}
template <class TAttestation>

View File

@@ -71,7 +71,7 @@ public:
{
setupDatabaseDir(getDatabasePath());
}
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
catch (std::exception const&)
{
}
}
@@ -81,7 +81,7 @@ public:
{
cleanupDatabaseDir(getDatabasePath());
}
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
catch (std::exception const&)
{
}
}

View File

@@ -58,7 +58,7 @@ public:
{
setupDatabaseDir(getDatabasePath());
}
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
catch (std::exception const&)
{
}
}
@@ -68,7 +68,7 @@ public:
{
cleanupDatabaseDir(getDatabasePath());
}
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
catch (std::exception const&)
{
}
}

View File

@@ -587,10 +587,10 @@ Env::st(JTx const& jt)
{
return sterilize(STTx{std::move(*obj)});
}
catch (...)
catch (std::exception const&)
{
return nullptr;
}
return nullptr;
}
std::shared_ptr<STTx const>
@@ -613,10 +613,10 @@ Env::ust(JTx const& jt)
{
return std::make_shared<STTx const>(std::move(*obj));
}
catch (...)
catch (std::exception const&)
{
return nullptr;
}
return nullptr;
}
Json::Value

View File

@@ -339,8 +339,8 @@ validDocumentID(AnyValue const& v)
}
catch (...)
{
return false;
}
return false;
}
} // namespace oracle

View File

@@ -107,7 +107,6 @@ class WSClientImpl : public WSClient
{
stream_.cancel();
}
// NOLINTNEXTLINE(bugprone-empty-catch)
catch (boost::system::system_error const&)
{
// ignored

View File

@@ -35,7 +35,7 @@ TEST(scope, scope_exit)
scope_exit x{[&i]() { i = 5; }};
throw 1;
}
catch (...) // NOLINT(bugprone-empty-catch)
catch (...)
{
}
}
@@ -47,7 +47,7 @@ TEST(scope, scope_exit)
x.release();
throw 1;
}
catch (...) // NOLINT(bugprone-empty-catch)
catch (...)
{
}
}
@@ -85,7 +85,7 @@ TEST(scope, scope_fail)
scope_fail x{[&i]() { i = 5; }};
throw 1;
}
catch (...) // NOLINT(bugprone-empty-catch)
catch (...)
{
}
}
@@ -97,7 +97,7 @@ TEST(scope, scope_fail)
x.release();
throw 1;
}
catch (...) // NOLINT(bugprone-empty-catch)
catch (...)
{
}
}
@@ -135,7 +135,7 @@ TEST(scope, scope_success)
scope_success x{[&i]() { i = 5; }};
throw 1;
}
catch (...) // NOLINT(bugprone-empty-catch)
catch (...)
{
}
}
@@ -147,7 +147,7 @@ TEST(scope, scope_success)
x.release();
throw 1;
}
catch (...) // NOLINT(bugprone-empty-catch)
catch (...)
{
}
}

View File

@@ -241,7 +241,7 @@ public:
newNode->getHash().as_uint256(), std::make_shared<Blob>(s.begin(), s.end()));
}
}
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
catch (std::exception const&)
{
}
}

View File

@@ -1637,7 +1637,7 @@ LedgerMaster::getLedgerBySeq(std::uint32_t index)
if (hash)
return mLedgerHistory.getLedgerByHash(*hash);
}
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
catch (std::exception const&)
{
// Missing nodes are already handled
}

View File

@@ -127,7 +127,7 @@ SkipListAcquire::processData(
return;
}
}
catch (...) // NOLINT(bugprone-empty-catch)
catch (...)
{
}

View File

@@ -29,7 +29,7 @@ getEndpoint(std::string const& peer)
if (endpoint)
return beast::IP::to_asio_endpoint(endpoint.value());
}
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
catch (std::exception const&)
{
}
return {};

View File

@@ -177,7 +177,7 @@ ValidatorSite::stop()
{
timer_.cancel();
}
catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch)
catch (boost::system::system_error const&)
{
}
stopping_ = false;
@@ -222,7 +222,7 @@ ValidatorSite::makeRequest(
{
timer_.cancel_one();
}
catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch)
catch (boost::system::system_error const&)
{
}
};

View File

@@ -252,7 +252,7 @@ ConnectAttempt::cancelTimer()
timer_.cancel();
stepTimer_.cancel();
}
catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch)
catch (boost::system::system_error const&)
{
// ignored
}

View File

@@ -59,7 +59,7 @@ to_string(ProtocolVersion const& p)
}
std::vector<ProtocolVersion>
parseProtocolVersions(std::string_view const& value)
parseProtocolVersions(boost::beast::string_view const& value)
{
static boost::regex re(
"^" // start of line
@@ -130,7 +130,7 @@ negotiateProtocolVersion(std::vector<ProtocolVersion> const& versions)
}
std::optional<ProtocolVersion>
negotiateProtocolVersion(std::string_view const& versions)
negotiateProtocolVersion(boost::beast::string_view const& versions)
{
auto const them = parseProtocolVersions(versions);

View File

@@ -1,9 +1,10 @@
#pragma once
#include <boost/beast/core/string.hpp>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@@ -38,7 +39,7 @@ to_string(ProtocolVersion const& p);
no duplicates and will be sorted in ascending protocol order.
*/
std::vector<ProtocolVersion>
parseProtocolVersions(std::string_view const& s);
parseProtocolVersions(boost::beast::string_view const& s);
/** Given a list of supported protocol versions, choose the one we prefer. */
std::optional<ProtocolVersion>
@@ -46,7 +47,7 @@ negotiateProtocolVersion(std::vector<ProtocolVersion> const& versions);
/** Given a list of supported protocol versions, choose the one we prefer. */
std::optional<ProtocolVersion>
negotiateProtocolVersion(std::string_view const& versions);
negotiateProtocolVersion(boost::beast::string_view const& versions);
/** The list of all the protocol versions we support. */
std::string const&

View File

@@ -1479,7 +1479,7 @@ rpcClient(
setup = setup_ServerHandler(
config, beast::logstream{logs.journal("HTTPClient").warn()});
}
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
catch (std::exception const&)
{
// ignore any exceptions, so the command
// line client works without a config file

View File

@@ -34,7 +34,6 @@
#include <algorithm>
#include <memory>
#include <stdexcept>
#include <string_view>
namespace xrpl {
@@ -231,7 +230,7 @@ ServerHandler::onHandoff(
static inline Json::Output
makeOutput(Session& session)
{
return [&](std::string_view const& b) { session.write(b.data(), b.size()); };
return [&](boost::beast::string_view const& b) { session.write(b.data(), b.size()); };
}
static std::map<std::string, std::string>
@@ -528,14 +527,11 @@ ServerHandler::processSession(
makeOutput(*session),
coro,
forwardedFor(session->request()),
[&]() -> std::string_view {
[&] {
auto const iter = session->request().find("X-User");
if (iter != session->request().end())
{
auto const val = iter->value();
return std::string_view(val.data(), val.size());
}
return std::string_view{};
return iter->value();
return boost::beast::string_view{};
}());
if (beast::rfc2616::is_keep_alive(session->request()))