Skip to content

Commit e04cb9c

Browse files
committed
Merge bitcoin/bitcoin#33201: Add functional test for IPC interface
a341e11 ci: test IPC on additional hosts (Sjors Provoost) 6aee573 ci: enable IPC tests in CI (Pieter Wuille) 8d2ee88 tests: add functional tests for IPC interface (Pieter Wuille) 3cc9a06 test: Add TestNode ipcbind option (Ryan Ofsky) 3cceb60 test: Provide path to `bitcoin` binary (Ryan Ofsky) 8c7f005 test: add is_ipc_compiled() and skip_if_no_ipc() functions (Ryan Ofsky) Pull request description: This adds support to the functional test framework to run the multiprocess `bitcoin-node` binary, and then tests it in a new `interface_ipc.py` functional test through the `pycapnp` module. ACKs for top commit: Sjors: ACK a341e11 ryanofsky: Code review ACK a341e11. Changes since last review: rebasing, switching to miniwallet and expanding wallet test, improving pycapnp install steps in instructions and CI. TheCharlatan: ACK a341e11 Tree-SHA512: 98330283cf0d66d5537eec1219345b8aec5740dbc2171bd8b70680d7a282e0962fcdf0588a75518110761e8bc95af57d6097c93937cac710805b0df10837093c
2 parents 37c21eb + a341e11 commit e04cb9c

14 files changed

+290
-20
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ jobs:
9595
- run: |
9696
sudo apt-get update
9797
sudo apt-get install clang mold ccache build-essential cmake ninja-build pkgconf python3-zmq libevent-dev libboost-dev libsqlite3-dev systemtap-sdt-dev libzmq3-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev capnproto libcapnp-dev -y
98+
sudo pip3 install --break-system-packages pycapnp
9899
- name: Compile and run tests
99100
run: |
100101
# Run tests on commits after the last merge commit and before the PR head commit
@@ -152,6 +153,11 @@ jobs:
152153
brew install --quiet python@3 || brew link --overwrite python@3
153154
brew install --quiet coreutils ninja pkgconf gnu-getopt ccache boost libevent zeromq qt@6 qrencode capnp
154155
156+
- name: Install Python packages
157+
run: |
158+
git clone -b v2.1.0 https://github.com/capnproto/pycapnp
159+
pip3 install ./pycapnp -C force-bundled-libcapnp=True --break-system-packages
160+
155161
- name: Set Ccache directory
156162
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
157163

@@ -275,6 +281,7 @@ jobs:
275281
if: matrix.job-type == 'standard'
276282
working-directory: build
277283
env:
284+
BITCOIN_BIN: '${{ github.workspace }}\build\bin\Release\bitcoin.exe'
278285
BITCOIND: '${{ github.workspace }}\build\bin\Release\bitcoind.exe'
279286
BITCOINCLI: '${{ github.workspace }}\build\bin\Release\bitcoin-cli.exe'
280287
BITCOINTX: '${{ github.workspace }}\build\bin\Release\bitcoin-tx.exe'

ci/test/00_setup_env_native_asan.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ fi
2020

2121
export CONTAINER_NAME=ci_native_asan
2222
export APT_LLVM_V="21"
23-
export PACKAGES="systemtap-sdt-dev clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev python3-zmq qt6-base-dev qt6-tools-dev qt6-l10n-tools libevent-dev libboost-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE} libcapnp-dev capnproto"
23+
export PACKAGES="systemtap-sdt-dev clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev python3-zmq qt6-base-dev qt6-tools-dev qt6-l10n-tools libevent-dev libboost-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE} libcapnp-dev capnproto python3-pip"
24+
export PIP_PACKAGES="--break-system-packages pycapnp"
2425
export NO_DEPENDS=1
2526
export GOAL="install"
2627
export CI_LIMIT_STACK_SIZE=1

ci/test/00_setup_env_native_centos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
99
export CONTAINER_NAME=ci_native_centos
1010
export CI_IMAGE_NAME_TAG="quay.io/centos/centos:stream10"
1111
export CI_BASE_PACKAGES="gcc-c++ glibc-devel libstdc++-devel ccache make ninja-build git python3 python3-pip which patch xz procps-ng rsync coreutils bison e2fsprogs cmake dash"
12-
export PIP_PACKAGES="pyzmq"
12+
export PIP_PACKAGES="pyzmq pycapnp"
1313
export DEP_OPTS="DEBUG=1"
1414
export GOAL="install"
1515
export BITCOIN_CONFIG="\

ci/test/00_setup_env_native_msan.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${L
1414
export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}"
1515

1616
export CONTAINER_NAME="ci_native_msan"
17-
export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} llvm-${APT_LLVM_V}-dev libclang-${APT_LLVM_V}-dev libclang-rt-${APT_LLVM_V}-dev"
17+
export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} llvm-${APT_LLVM_V}-dev libclang-${APT_LLVM_V}-dev libclang-rt-${APT_LLVM_V}-dev python3-pip"
18+
export PIP_PACKAGES="--break-system-packages pycapnp"
1819
export DEP_OPTS="DEBUG=1 NO_QT=1 CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
1920
export GOAL="install"
2021
export CI_LIMIT_STACK_SIZE=1

ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export LC_ALL=C.UTF-8
99
export CONTAINER_NAME=ci_native_nowallet_libbitcoinkernel
1010
export CI_IMAGE_NAME_TAG="mirror.gcr.io/debian:bookworm"
1111
# Use minimum supported python3.10 (or best-effort 3.11) and clang-16, see doc/dependencies.md
12-
export PACKAGES="python3-zmq clang-16 llvm-16 libc++abi-16-dev libc++-16-dev"
12+
export PACKAGES="python3-zmq python3-pip clang-16 llvm-16 libc++abi-16-dev libc++-16-dev"
13+
export PIP_PACKAGES="--break-system-packages pycapnp"
1314
export DEP_OPTS="NO_WALLET=1 CC=clang-16 CXX='clang++-16 -stdlib=libc++'"
1415
export GOAL="install"
1516
export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON -DBUILD_UTIL_CHAINSTATE=ON -DBUILD_KERNEL_LIB=ON -DBUILD_SHARED_LIBS=ON"

ci/test/00_setup_env_native_tsan.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
1111
export APT_LLVM_V="21"
1212
LIBCXX_DIR="/cxx_build/"
1313
LIBCXX_FLAGS="-fsanitize=thread -nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument"
14-
export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} llvm-${APT_LLVM_V}-dev libclang-${APT_LLVM_V}-dev libclang-rt-${APT_LLVM_V}-dev python3-zmq"
14+
export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} llvm-${APT_LLVM_V}-dev libclang-${APT_LLVM_V}-dev libclang-rt-${APT_LLVM_V}-dev python3-zmq python3-pip"
15+
export PIP_PACKAGES="--break-system-packages pycapnp"
1516
export DEP_OPTS="CC=clang CXX=clang++ CXXFLAGS='${LIBCXX_FLAGS}' NO_QT=1"
1617
export GOAL="install"
1718
export CI_LIMIT_STACK_SIZE=1

ci/test/00_setup_env_native_valgrind.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export LC_ALL=C.UTF-8
88

99
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
1010
export CONTAINER_NAME=ci_native_valgrind
11-
export PACKAGES="valgrind python3-zmq libevent-dev libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto"
11+
export PACKAGES="valgrind python3-zmq libevent-dev libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto python3-pip"
12+
export PIP_PACKAGES="--break-system-packages pycapnp"
1213
export USE_VALGRIND=1
1314
export NO_DEPENDS=1
1415
# bind tests excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function(create_test_config)
2626
set_configure_variable(WITH_ZMQ ENABLE_ZMQ)
2727
set_configure_variable(ENABLE_EXTERNAL_SIGNER ENABLE_EXTERNAL_SIGNER)
2828
set_configure_variable(WITH_USDT ENABLE_USDT_TRACEPOINTS)
29+
set_configure_variable(ENABLE_IPC ENABLE_IPC)
2930

3031
configure_file(config.ini.in config.ini USE_SOURCE_PERMISSIONS @ONLY)
3132
endfunction()

test/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ The ZMQ functional test requires a python ZMQ library. To install it:
3434
- on Unix, run `sudo apt-get install python3-zmq`
3535
- on mac OS, run `pip3 install pyzmq`
3636

37+
The IPC functional test requires a python IPC library. `pip3 install pycapnp` may work, but if not, install it from source:
38+
39+
```sh
40+
git clone -b v2.1.0 https://github.com/capnproto/pycapnp
41+
pip3 install ./pycapnp
42+
```
43+
44+
If that does not work, try adding `-C force-bundled-libcapnp=True` to the `pip` command.
45+
Depending on the system, it may be necessary to install and run in a venv:
46+
47+
```sh
48+
python -m venv venv
49+
git clone -b v2.1.0 https://github.com/capnproto/pycapnp
50+
venv/bin/pip3 install ./pycapnp -C force-bundled-libcapnp=True
51+
venv/bin/python3 build/test/functional/interface_ipc.py
52+
```
3753

3854
On Windows the `PYTHONUTF8` environment variable must be set to 1:
3955

test/config.ini.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ RPCAUTH=@abs_top_srcdir@/share/rpcauth/rpcauth.py
2626
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=true
2727
@ENABLE_EXTERNAL_SIGNER_TRUE@ENABLE_EXTERNAL_SIGNER=true
2828
@ENABLE_USDT_TRACEPOINTS_TRUE@ENABLE_USDT_TRACEPOINTS=true
29+
@ENABLE_IPC_TRUE@ENABLE_IPC=true

0 commit comments

Comments
 (0)