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 e6c09e61b2
commit a9dff49837
7 changed files with 19 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
@@ -161,6 +162,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

@@ -20,6 +20,11 @@ on:
required: false
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
@@ -75,3 +80,4 @@ jobs:
image: ${{ inputs.image }}
config_name: ${{ inputs.config_name }}
nproc_subtract: ${{ inputs.nproc_subtract }}
unittest_args: ${{ inputs.unittest_args }}

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

@@ -11,6 +11,11 @@ on:
description: "Whether to run unit tests"
required: true
type: boolean
unittest_args:
description: 'Additional arguments to pass to rippled when running tests'
required: false
type: string
default: ""
runs_on:
description: Runner to run the job on as a JSON string
@@ -83,7 +88,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: Run the separate tests
if: ${{ inputs.run_tests }}

View File

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

View File

@@ -11,12 +11,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

@@ -33,7 +33,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();