diff options
| author | Leitwolf | 2026-11-18 08:55:23 +0300 |
|---|---|---|
| committer | GitHub | 2026-11-18 08:55:23 +0300 |
| commit | 0e2230428bb2a7198cb5b542ebcc22fb14ac1375 (patch) | |
| tree | 2e6a2ea7a5edd3593bf84f687a1bbf548d0d45a3 | |
| parent | 10731efd02e461d090325632b9ceb9c373f616da (diff) | |
| parent | cec943e86ac52c43e2a8780a2ac4e6b0a71f56cb (diff) | |
| download | catch3-0e2230428bb2a7198cb5b542ebcc22fb14ac1375.tar.gz | |
Merge branch 'devel' into docs/site-links
| -rw-r--r-- | .github/workflows/fuzzing.yml | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/.github/workflows/fuzzing.yml b/.github/workflows/fuzzing.yml new file mode 100644 index 00000000..c6a1e596 --- /dev/null +++ b/.github/workflows/fuzzing.yml @@ -0,0 +1,96 @@ +# SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +# SPDX-License-Identifier: LGPL-3.0-or-later + +name: Fuzzing + +# Each fuzz target reads input from outside: test specs, the project +# configuration, the runner's JSON and its command line. A pull request runs +# each for two minutes; every night each runs for thirty. The corpus each run +# grows is kept in the cache of the devel branch, so the next run starts from +# it, and a crash uploads its input. A crash input becomes a regression test. + +on: + push: + branches: [devel] + pull_request: + schedule: + - cron: '17 2 * * *' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: fuzzing-${{ github.ref }} + cancel-in-progress: true + +jobs: + fuzz: + name: Fuzz ${{matrix.target}} + runs-on: ubuntu-26.04 + timeout-minutes: 50 + strategy: + fail-fast: false + matrix: + target: [TestSpecParser, ProjectConfig, RunnerJson, RunnerOptions] + + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false + + - name: Install Clang, CMake and Ninja + run: | + sudo apt-get update + sudo apt-get install -y clang cmake ninja-build + + - name: Configure + run: | + cmake -S . -B build-fuzzers -GNinja \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DCMAKE_CXX_FLAGS="-fsanitize=fuzzer-no-link,address,undefined -fno-sanitize-recover=undefined" \ + -DCATCH3_DEVELOPMENT_BUILD=ON \ + -DCATCH3_BUILD_FUZZERS=ON \ + -DCATCH3_BUILD_TESTING=OFF \ + -DCATCH3_BUILD_EXAMPLES=OFF \ + -DCATCH3_BUILD_EXTRA_TESTS=OFF \ + -DCATCH3_ENABLE_WERROR=OFF \ + -DBUILD_TESTING=OFF + + - name: Build + run: cmake --build build-fuzzers --target fuzz_${{matrix.target}} + + - name: Restore the corpus + uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0 + with: + path: corpus/${{matrix.target}} + key: fuzz-corpus-${{matrix.target}}-${{github.run_id}} + restore-keys: fuzz-corpus-${{matrix.target}}- + + - name: Fuzz + env: + TARGET: ${{matrix.target}} + SECONDS_PER_TARGET: ${{ github.event_name == 'schedule' && 1800 || 120 }} + ASAN_OPTIONS: detect_leaks=1:abort_on_error=1 + UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 + run: | + mkdir -p "corpus/$TARGET" crashes + binary=$(find build-fuzzers -type f -name "fuzz_$TARGET" -perm -u+x | head -n 1) + "$binary" -max_total_time="$SECONDS_PER_TARGET" -timeout=10 -rss_limit_mb=2048 \ + -artifact_prefix=crashes/ -print_final_stats=1 "corpus/$TARGET" + + - name: Upload crash inputs + if: failure() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: fuzz-crashes-${{matrix.target}} + path: crashes/ + if-no-files-found: ignore + + - name: Keep the corpus + if: success() && github.event_name != 'pull_request' + uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0 + with: + path: corpus/${{matrix.target}} + key: fuzz-corpus-${{matrix.target}}-${{github.run_id}} |