Skip to content

Commit 6e5b67a

Browse files
committed
Merge bitcoin/bitcoin#32697: test: Turn util/test_runner into functional test
fa21631 test: Use self.log (MarcoFalke) fa346f7 test: Move error string into exception (MarcoFalke) fa19861 test: Remove useless catch-throw (MarcoFalke) fa2f1c5 move-only util data to test/functional/data/util (MarcoFalke) faa18bf test: Turn util/test_runner into functional test (MarcoFalke) fa95515 test: Add missing skip_if_no_bitcoin_tx (MarcoFalke) fac9db6 test: Add missing tx util to Binaries (MarcoFalke) fa91835 test: Use lowercase env var as attribute name (MarcoFalke) fac4909 test: Remove duplicate ConfigParser (MarcoFalke) Pull request description: The `test/util/test_runner.py` has many issues: * The boilerplate for the test runner is duplicate or inconsistent with the other (functional) tests. For example, logging options, `ConfigParser` handling, `Binaries` handling ... * The cmake/ci behavior is brittle and can silently fail, as explained in bitcoin/bitcoin#31476 * corecheck (and likely other places that manually run the tests) completely forget to run it * If the test is manually called, it runs single threaded, when it could just run in parallel with the other functional tests Fix all issues by removing the util test_runner and moving the test logic into a new functional test file. ACKs for top commit: janb84: re ACK fa21631 brunoerg: re-ACK fa21631 hebasto: re-ACK fa21631, additional feedback has been addressed since my previous [review](bitcoin/bitcoin#32697 (review)). Tree-SHA512: 694e647887801f002843a74011035d5ed3dfed091d3f0ae18e812a16a4680e04e60e50de0a92af7e047e8ddd6ff5a7834c690f16fd42b74ebc1674bf9989406f
2 parents fb2c16c + fa21631 commit 6e5b67a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+165
-216
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ jobs:
260260
env:
261261
BITCOIND: '${{ github.workspace }}\build\bin\Release\bitcoind.exe'
262262
BITCOINCLI: '${{ github.workspace }}\build\bin\Release\bitcoin-cli.exe'
263+
BITCOINTX: '${{ github.workspace }}\build\bin\Release\bitcoin-tx.exe'
263264
BITCOINUTIL: '${{ github.workspace }}\build\bin\Release\bitcoin-util.exe'
264265
BITCOINWALLET: '${{ github.workspace }}\build\bin\Release\bitcoin-wallet.exe'
265266
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
@@ -389,9 +390,6 @@ jobs:
389390
(Get-Content "test/config.ini") -replace '(?<=^SRCDIR=).*', '${{ github.workspace }}' -replace '(?<=^BUILDDIR=).*', '${{ github.workspace }}' -replace '(?<=^RPCAUTH=).*', '${{ github.workspace }}/share/rpcauth/rpcauth.py' | Set-Content "test/config.ini"
390391
Get-Content "test/config.ini"
391392
392-
- name: Run util tests
393-
run: py -3 test/util/test_runner.py
394-
395393
- name: Run rpcauth test
396394
run: py -3 test/util/rpcauth-test.py
397395

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ if(Python3_EXECUTABLE)
594594
set(PYTHON_COMMAND ${Python3_EXECUTABLE})
595595
else()
596596
list(APPEND configure_warnings
597-
"Minimum required Python not found. Utils and rpcauth tests are disabled."
597+
"Minimum required Python not found. Rpcauth tests are disabled."
598598
)
599599
endif()
600600

cmake/tests.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
# Distributed under the MIT software license, see the accompanying
33
# file COPYING or https://opensource.org/license/mit/.
44

5-
if(TARGET bitcoin-util AND TARGET bitcoin-tx AND PYTHON_COMMAND)
6-
add_test(NAME util_test_runner
7-
COMMAND ${CMAKE_COMMAND} -E env BITCOINUTIL=$<TARGET_FILE:bitcoin-util> BITCOINTX=$<TARGET_FILE:bitcoin-tx> ${PYTHON_COMMAND} ${PROJECT_BINARY_DIR}/test/util/test_runner.py
8-
)
9-
endif()
10-
115
if(PYTHON_COMMAND)
126
add_test(NAME util_rpcauth_test
137
COMMAND ${PYTHON_COMMAND} ${PROJECT_BINARY_DIR}/test/util/rpcauth-test.py

test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function(create_test_config)
1717

1818
set_configure_variable(ENABLE_WALLET ENABLE_WALLET)
1919
set_configure_variable(BUILD_CLI BUILD_BITCOIN_CLI)
20+
set_configure_variable(BUILD_TX BUILD_BITCOIN_TX)
2021
set_configure_variable(BUILD_UTIL BUILD_BITCOIN_UTIL)
2122
set_configure_variable(BUILD_UTIL_CHAINSTATE BUILD_BITCOIN_CHAINSTATE)
2223
set_configure_variable(BUILD_WALLET_TOOL BUILD_BITCOIN_WALLET)
@@ -36,7 +37,7 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fuzz)
3637
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/util)
3738

3839
file(GLOB_RECURSE functional_tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} functional/*)
39-
foreach(script ${functional_tests} fuzz/test_runner.py util/rpcauth-test.py util/test_runner.py)
40+
foreach(script ${functional_tests} fuzz/test_runner.py util/rpcauth-test.py)
4041
if(CMAKE_HOST_WIN32)
4142
set(symlink)
4243
else()

test/README.md

Lines changed: 1 addition & 7 deletions

test/config.ini.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ RPCAUTH=@abs_top_srcdir@/share/rpcauth/rpcauth.py
1717
# Which components are enabled. These are commented out by cmake if they were disabled during configuration.
1818
@ENABLE_WALLET_TRUE@ENABLE_WALLET=true
1919
@BUILD_BITCOIN_CLI_TRUE@ENABLE_CLI=true
20+
@BUILD_BITCOIN_TX_TRUE@BUILD_BITCOIN_TX=true
2021
@BUILD_BITCOIN_UTIL_TRUE@ENABLE_BITCOIN_UTIL=true
2122
@BUILD_BITCOIN_CHAINSTATE_TRUE@ENABLE_BITCOIN_CHAINSTATE=true
2223
@BUILD_BITCOIN_WALLET_TRUE@ENABLE_WALLET_TOOL=true

0 commit comments

Comments
 (0)