Skip to content

Commit a4ca497

Browse files
committed
Merge bitcoin/bitcoin#28161: ci: Move ASan USDT to persistent_worker
fa47439 ci: Add missing linux-headers package to ASan task (MarcoFalke) fabaa85 ci: Move ASan USDT to persistent_worker (MarcoFalke) Pull request description: To run the USDT functional tests, the ASan task currently requires the container host to run the Ubuntu Lunar Linux kernel (or later). Cirrus CI is the only provider that allows to spin up full VMs with Ubuntu Lunar, however they will start to charge for all tasks (See slightly related discussion in bitcoin/bitcoin#28098). Since it is cheaper and recommended by Cirrus CI to just run a persistent worker, do that. Also, using a persistent worker allows to make use of the docker image cache. ACKs for top commit: hebasto: ACK fa47439, I have reviewed the code and it looks OK. Tree-SHA512: afd084ab1b56cbc3fa44d4611aaa01ec21c1d80aedf1f5f1bc4b8b3d1bd08095e0c7fcea7a3e6ec4b6cd97d01e97ee86061eb84a5e2c7e7195ce02a186254900
2 parents da3816e + fa47439 commit a4ca497

File tree

4 files changed

+30
-19
lines changed

4 files changed

+30
-19
lines changed

.cirrus.yml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,24 @@ cirrus_ephemeral_worker_template_env: &CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
1414
persistent_worker_template_env: &PERSISTENT_WORKER_TEMPLATE_ENV
1515
RESTART_CI_DOCKER_BEFORE_RUN: "1"
1616

17+
# https://cirrus-ci.org/guide/persistent-workers/
18+
#
19+
# It is possible to select a specific persistent worker by label. Refer to the
20+
# Cirrus CI docs for more details.
21+
#
22+
# Generally, a persistent worker must run Ubuntu 23.04+ or Debian 12+.
23+
# Specifically,
24+
# - apt-get is required due to PACKAGE_MANAGER_INSTALL
25+
# - podman-docker-4.1+ is required due to the use of `podman` when
26+
# RESTART_CI_DOCKER_BEFORE_RUN is set and 4.1+ due to the bugfix in 4.1
27+
# (https://github.com/bitcoin/bitcoin/pull/21652)
28+
# - The ./ci/ depedencies should be installed:
29+
# apt update && apt install screen python3 bash podman-docker curl -y
30+
#
31+
# The following specific types should exist, with the following requirements:
32+
# - lunar: For a machine running the Linux kernel shipped with Ubuntu Lunar 23.04. The machine is recommended to have 4 CPUs and 16 GB of memory.
1733
persistent_worker_template: &PERSISTENT_WORKER_TEMPLATE
18-
persistent_worker: {} # https://cirrus-ci.org/guide/persistent-workers/
34+
persistent_worker: {} # Only use this if the task does not care about the type at all
1935

2036
# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
2137
filter_template: &FILTER_TEMPLATE
@@ -257,22 +273,17 @@ task:
257273

258274
task:
259275
name: '[ASan + LSan + UBSan + integer, no depends, USDT] [lunar]'
276+
enable_bpfcc_script:
277+
# In the image build step, no external environment variables are available,
278+
# so any settings will need to be written to the settings env file:
279+
- sed -i "s|\${CIRRUS_CI}|true|g" ./ci/test/00_setup_env_native_asan.sh
260280
<< : *GLOBAL_TASK_TEMPLATE
261-
# We can't use a 'container' for the USDT interface tests as the CirrusCI
262-
# containers don't have privileges to hook into bitcoind. CirrusCI uses
263-
# Google Compute Engine instances: https://cirrus-ci.org/guide/custom-vms/
264-
# Images can be found here: https://cloud.google.com/compute/docs/images/os-details
265-
compute_engine_instance:
266-
image_project: ubuntu-os-cloud
267-
image: family/ubuntu-2304-amd64 # https://cirrus-ci.org/guide/custom-vms/#custom-compute-engine-vms
268-
cpu: 4
269-
disk: 100
270-
memory: 12G
281+
persistent_worker:
282+
labels:
283+
type: lunar # Must use the lunar-specific worker (needed for USDT functional tests)
271284
env:
272-
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
273-
HOME: /root/ # Only needed for compute_engine_instance
285+
<< : *PERSISTENT_WORKER_TEMPLATE_ENV
274286
FILE_ENV: "./ci/test/00_setup_env_native_asan.sh"
275-
MAKEJOBS: "-j4" # Avoid excessive memory use
276287

277288
task:
278289
name: '[fuzzer,address,undefined,integer, no depends] [lunar]'

ci/test/00_setup_env_native_asan.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ export LC_ALL=C.UTF-8
88

99
# Only install BCC tracing packages in Cirrus CI.
1010
if [[ "${CIRRUS_CI}" == "true" ]]; then
11-
export BPFCC_PACKAGE="bpfcc-tools"
11+
BPFCC_PACKAGE="bpfcc-tools linux-headers-$(uname --kernel-release)"
12+
export CI_CONTAINER_CAP="--privileged -v /sys/kernel:/sys/kernel:rw"
1213
else
13-
export BPFCC_PACKAGE=""
14+
BPFCC_PACKAGE=""
15+
export CI_CONTAINER_CAP="--cap-add SYS_PTRACE" # If run with (ASan + LSan), the container needs access to ptrace (https://github.com/google/sanitizers/issues/764)
1416
fi
1517

1618
export CONTAINER_NAME=ci_native_asan

ci/test/00_setup_env_native_fuzz.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export RUN_UNIT_TESTS=false
1414
export RUN_FUNCTIONAL_TESTS=false
1515
export RUN_FUZZ_TESTS=true
1616
export GOAL="install"
17+
export CI_CONTAINER_CAP="--cap-add SYS_PTRACE" # If run with (ASan + LSan), the container needs access to ptrace (https://github.com/google/sanitizers/issues/764)
1718
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,address,undefined,float-divide-by-zero,integer \
1819
CC='clang-16 -ftrivial-auto-var-init=pattern' CXX='clang++-16 -ftrivial-auto-var-init=pattern'"
1920
export CCACHE_MAXSIZE=200M

ci/test/04_install.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ export ASAN_OPTIONS="detect_stack_use_after_return=1:check_initialization_order=
1818
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
1919
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1:log_path=${BASE_SCRATCH_DIR}/sanitizer-output/tsan"
2020
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1"
21-
if [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (ASan + LSan), Docker needs access to ptrace (https://github.com/google/sanitizers/issues/764)
22-
CI_CONTAINER_CAP="--cap-add SYS_PTRACE"
23-
fi
2421

2522
if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
2623
# Export all env vars to avoid missing some.

0 commit comments

Comments
 (0)