Skip to content

Commit 72ab35a

Browse files
committed
Merge bitcoin/bitcoin#31221: ci: Split out native fuzz jobs for macOS and windows (take 2)
b031b79 [ci] Split out native fuzz jobs for macOS and windows (dergoegge) Pull request description: Split out two new CI jobs (for native macOS and windows) that run the fuzz tests on the qa-assets input corpora. In both jobs the fuzz binary is built with `-DBUILD_FOR_FUZZING` to enable `Assume` assertions as well as `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION`. ACKs for top commit: maflcko: re-lgtm ACK b031b79 achow101: ACK b031b79 hebasto: ACK b031b79. Tree-SHA512: 7d0dc5a9cb299f6f4596dd9a5526b6aaf82efc6eba308bdc9d8b0a45f79dea87204fb6cd4b2ea2a1bd952466b2e958d64021999296d110d7a83c1667f4de51fe
2 parents f7144b2 + b031b79 commit 72ab35a

File tree

2 files changed

+68
-8
lines changed

2 files changed

+68
-8
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
git rebase --exec "echo Running test-one-commit on \$( git log -1 ) && CC=clang CXX=clang++ cmake -B build -DWERROR=ON -DWITH_ZMQ=ON -DBUILD_GUI=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWITH_BDB=ON -DWITH_USDT=ON -DCMAKE_CXX_FLAGS='-Wno-error=unused-member-function' && cmake --build build -j $(nproc) && ctest --output-on-failure --stop-on-failure --test-dir build -j $(nproc) && ./build/test/functional/test_runner.py -j $(( $(nproc) * 2 ))" ${{ env.TEST_BASE }}
7676
7777
macos-native-arm64:
78-
name: 'macOS 14 native, arm64, no depends, sqlite only, gui'
78+
name: ${{ matrix.job-name }}
7979
# Use latest image, but hardcode version to avoid silent upgrades (and breaks).
8080
# See: https://github.com/actions/runner-images#available-images.
8181
runs-on: macos-14
@@ -89,9 +89,20 @@ jobs:
8989

9090
timeout-minutes: 120
9191

92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
job-type: [standard, fuzz]
96+
include:
97+
- job-type: standard
98+
file-env: './ci/test/00_setup_env_mac_native.sh'
99+
job-name: 'macOS 14 native, arm64, no depends, sqlite only, gui'
100+
- job-type: fuzz
101+
file-env: './ci/test/00_setup_env_mac_native_fuzz.sh'
102+
job-name: 'macOS 14 native, arm64, fuzz'
103+
92104
env:
93105
DANGER_RUN_CI_ON_HOST: 1
94-
FILE_ENV: './ci/test/00_setup_env_mac_native.sh'
95106
BASE_ROOT_DIR: ${{ github.workspace }}
96107

97108
steps:
@@ -120,22 +131,24 @@ jobs:
120131
uses: actions/cache/restore@v4
121132
with:
122133
path: ${{ env.CCACHE_DIR }}
123-
key: ${{ github.job }}-ccache-${{ github.run_id }}
124-
restore-keys: ${{ github.job }}-ccache-
134+
key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}
135+
restore-keys: ${{ github.job }}-${{ matrix.job-type }}-ccache-
125136

126137
- name: CI script
127138
run: ./ci/test_run_all.sh
139+
env:
140+
FILE_ENV: ${{ matrix.file-env }}
128141

129142
- name: Save Ccache cache
130143
uses: actions/cache/save@v4
131144
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
132145
with:
133146
path: ${{ env.CCACHE_DIR }}
134147
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
135-
key: ${{ github.job }}-ccache-${{ github.run_id }}
148+
key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}
136149

137150
win64-native:
138-
name: 'Win64 native, VS 2022'
151+
name: ${{ matrix.job-name }}
139152
# Use latest image, but hardcode version to avoid silent upgrades (and breaks).
140153
# See: https://github.com/actions/runner-images#available-images.
141154
runs-on: windows-2022
@@ -146,6 +159,18 @@ jobs:
146159
PYTHONUTF8: 1
147160
TEST_RUNNER_TIMEOUT_FACTOR: 40
148161

162+
strategy:
163+
fail-fast: false
164+
matrix:
165+
job-type: [standard, fuzz]
166+
include:
167+
- job-type: standard
168+
generate-options: '-DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DWERROR=ON'
169+
job-name: 'Win64 native, VS 2022'
170+
- job-type: fuzz
171+
generate-options: '-DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="sqlite" -DBUILD_GUI=OFF -DBUILD_FOR_FUZZING=ON -DWERROR=ON'
172+
job-name: 'Win64 native fuzz, VS 2022'
173+
149174
steps:
150175
- name: Checkout
151176
uses: actions/checkout@v4
@@ -186,11 +211,11 @@ jobs:
186211

187212
- name: Generate build system
188213
run: |
189-
cmake -B build --preset vs2022-static -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWERROR=ON
214+
cmake -B build --preset vs2022-static -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" ${{ matrix.generate-options }}
190215
191216
- name: Save vcpkg binary cache
192217
uses: actions/cache/save@v4
193-
if: github.event_name != 'pull_request' && steps.vcpkg-binary-cache.outputs.cache-hit != 'true'
218+
if: github.event_name != 'pull_request' && steps.vcpkg-binary-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard'
194219
with:
195220
path: ~/AppData/Local/vcpkg/archives
196221
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
@@ -201,11 +226,13 @@ jobs:
201226
cmake --build . -j $env:NUMBER_OF_PROCESSORS --config Release
202227
203228
- name: Run test suite
229+
if: matrix.job-type == 'standard'
204230
working-directory: build
205231
run: |
206232
ctest --output-on-failure --stop-on-failure -j $env:NUMBER_OF_PROCESSORS -C Release
207233
208234
- name: Run functional tests
235+
if: matrix.job-type == 'standard'
209236
working-directory: build
210237
env:
211238
BITCOIND: '${{ github.workspace }}\build\src\Release\bitcoind.exe'
@@ -216,6 +243,23 @@ jobs:
216243
shell: cmd
217244
run: py -3 test\functional\test_runner.py --jobs %NUMBER_OF_PROCESSORS% --ci --quiet --tmpdirprefix=%RUNNER_TEMP% --combinedlogslen=99999999 --timeout-factor=%TEST_RUNNER_TIMEOUT_FACTOR% %TEST_RUNNER_EXTRA%
218245

246+
- name: Clone corpora
247+
if: matrix.job-type == 'fuzz'
248+
run: |
249+
git clone --depth=1 https://github.com/bitcoin-core/qa-assets "$env:RUNNER_TEMP\qa-assets"
250+
Set-Location "$env:RUNNER_TEMP\qa-assets"
251+
Write-Host "Using qa-assets repo from commit ..."
252+
git log -1
253+
254+
- name: Run fuzz tests
255+
if: matrix.job-type == 'fuzz'
256+
working-directory: build
257+
env:
258+
BITCOINFUZZ: '${{ github.workspace }}\build\src\test\fuzz\Release\fuzz.exe'
259+
shell: cmd
260+
run: |
261+
py -3 test\fuzz\test_runner.py --par %NUMBER_OF_PROCESSORS% --loglevel DEBUG %RUNNER_TEMP%\qa-assets\fuzz_corpora
262+
219263
asan-lsan-ubsan-integer-no-depends-usdt:
220264
name: 'ASan + LSan + UBSan + integer, no depends, USDT'
221265
runs-on: ubuntu-24.04 # has to match container in ci/test/00_setup_env_native_asan.sh for tracing tools
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) The Bitcoin Core developers
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
7+
export LC_ALL=C.UTF-8
8+
9+
export CMAKE_GENERATOR="Ninja"
10+
export BITCOIN_CONFIG="-DBUILD_FOR_FUZZING=ON"
11+
export CI_OS_NAME="macos"
12+
export NO_DEPENDS=1
13+
export OSX_SDK=""
14+
export RUN_UNIT_TESTS=false
15+
export RUN_FUNCTIONAL_TESTS=false
16+
export RUN_FUZZ_TESTS=true

0 commit comments

Comments
 (0)