Remove the cmake UNIT_TEST_REFERENCE_FEE setting

- Replaced by --unittest-fee runtime param
This commit is contained in:
Ed Hennis
2025-04-10 17:19:10 -04:00
parent 7dcc839d98
commit 330728eb2d
6 changed files with 14 additions and 13 deletions

View File

@@ -34,6 +34,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
# The default CMake target is 'all' for Linux and MacOS and 'install'
# for Windows, but it can get overridden for certain configurations.
cmake_target = 'install' if os["distro_name"] == 'windows' else 'all'
unittest_args = ''
# We build and test all configurations by default, except for Windows in
# Debug, because it is too slow, as well as when code coverage is
@@ -58,7 +59,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
skip = True
if os['distro_version'] == 'bookworm':
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-13' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
cmake_args = f'-DUNIT_TEST_REFERENCE_FEE=500 {cmake_args}'
unittest_args = f'{unittest_args} --unittest-fee=500'
skip = False
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-15' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
skip = False
@@ -66,7 +67,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
cmake_args = f'-Dvoidstar=ON {cmake_args}'
skip = False
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-17' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
cmake_args = f'-DUNIT_TEST_REFERENCE_FEE=1000 {cmake_args}'
unittest_args = f'{unittest_args} --unittest-fee=1000'
skip = False
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-20' and build_type == 'Debug' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
skip = False
@@ -159,6 +160,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
configurations.append({
'config_name': config_name,
'cmake_args': cmake_args,
'unittest_args' : unittest_args,
'cmake_target': cmake_target,
'build_only': build_only,
'build_type': build_type,

View File

@@ -24,6 +24,12 @@ on:
type: string
default: ""
unittest_args:
description: 'Additional arguments to pass to rippled when running tests'
required: false
type: string
default: ""
cmake_target:
description: "The CMake target to build."
type: string
@@ -205,7 +211,8 @@ jobs:
env:
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
run: |
./rippled --unittest --unittest-jobs "${BUILD_NPROC}"
./rippled --unittest --unittest-jobs "${BUILD_NPROC}" \
${{ inputs.unittest_args }}
- name: Debug failure (Linux)
if: ${{ failure() && runner.os == 'Linux' && !inputs.build_only }}

View File

@@ -50,6 +50,7 @@ jobs:
build_only: ${{ matrix.build_only }}
build_type: ${{ matrix.build_type }}
cmake_args: ${{ matrix.cmake_args }}
unittest_args: ${{ matrix.unittest_args }}
cmake_target: ${{ matrix.cmake_target }}
runs_on: ${{ toJSON(matrix.architecture.runner) }}
image: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-{4}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version, matrix.os.image_sha) || '' }}

View File

@@ -168,9 +168,6 @@ if(xrpld)
add_executable(xrpld)
if(tests)
target_compile_definitions(xrpld PUBLIC ENABLE_TESTS)
target_compile_definitions(xrpld PRIVATE
UNIT_TEST_REFERENCE_FEE=${UNIT_TEST_REFERENCE_FEE}
)
endif()
target_include_directories(xrpld
PRIVATE

View File

@@ -26,12 +26,6 @@ option(assert "Enables asserts, even in release builds" OFF)
option(xrpld "Build xrpld" ON)
option(tests "Build tests" ON)
if(tests)
# This setting allows making a separate workflow to test fees other than default 10
if(NOT UNIT_TEST_REFERENCE_FEE)
set(UNIT_TEST_REFERENCE_FEE "10" CACHE STRING "")
endif()
endif()
option(unity "Creates a build using UNITY support in cmake." OFF)
if(unity)

View File

@@ -14,7 +14,7 @@ setupConfigForUnitTests(Config& cfg)
using namespace jtx;
// Default fees to old values, so tests don't have to worry about changes in
// Config.h
cfg.FEES.reference_fee = UNIT_TEST_REFERENCE_FEE;
cfg.FEES.reference_fee = XRPAmount(10);
cfg.FEES.account_reserve = XRP(200).value().xrp().drops();
cfg.FEES.owner_reserve = XRP(50).value().xrp().drops();