diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py index c762d61ccd..b88bc23a05 100755 --- a/.github/scripts/strategy-matrix/generate.py +++ b/.github/scripts/strategy-matrix/generate.py @@ -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, diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index 4a8bc71321..2d67706440 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -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 }} diff --git a/.github/workflows/reusable-build-test.yml b/.github/workflows/reusable-build-test.yml index c6e991df79..e522e684b2 100644 --- a/.github/workflows/reusable-build-test.yml +++ b/.github/workflows/reusable-build-test.yml @@ -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) || '' }} diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 40b5535fc7..d71a7d6de1 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -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 diff --git a/cmake/XrplSettings.cmake b/cmake/XrplSettings.cmake index be339c135e..a421fbeb48 100644 --- a/cmake/XrplSettings.cmake +++ b/cmake/XrplSettings.cmake @@ -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) diff --git a/src/test/jtx/impl/envconfig.cpp b/src/test/jtx/impl/envconfig.cpp index 8cf416a4c5..e6acc5d268 100644 --- a/src/test/jtx/impl/envconfig.cpp +++ b/src/test/jtx/impl/envconfig.cpp @@ -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();