simplify building of fuzzer

PiperOrigin-RevId: 545950923
This commit is contained in:
Evgenii Kliuchnikov 2023-07-06 11:56:38 +00:00 committed by Evgenii Kliuchnikov
parent 413b098564
commit 70e7b1ae4a
26 changed files with 65 additions and 2 deletions

View File

@ -13,6 +13,10 @@ on:
pull_request: pull_request:
types: [opened, reopened, labeled, synchronize] types: [opened, reopened, labeled, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs: jobs:
ubuntu_build: ubuntu_build:
name: Build and test ${{ matrix.name }} name: Build and test ${{ matrix.name }}
@ -288,8 +292,15 @@ jobs:
- name: Quick Fuzz - name: Quick Fuzz
if: ${{ matrix.build_system == 'fuzz' }} if: ${{ matrix.build_system == 'fuzz' }}
run: | run: |
export ASAN_OPTIONS=detect_leaks=0 mkdir ${RUNNER_TEMP}/decode_corpora
./c/fuzz/test_fuzzer.sh unzip java/org/brotli/integration/fuzz_data.zip -d ${RUNNER_TEMP}/decode_corpora
cd ${GITHUB_WORKSPACE}/c/fuzz
bazelisk build --config=asan-libfuzzer :decode_fuzzer
for f in `ls ${RUNNER_TEMP}/decode_corpora`
do
echo "Testing $f"
./bazel-bin/decode_fuzzer_bin ${RUNNER_TEMP}/decode_corpora/$f
done
- name: Build with Bazel - name: Build with Bazel
if: ${{ matrix.build_system == 'bazel' }} if: ${{ matrix.build_system == 'bazel' }}

View File

@ -9,6 +9,10 @@ on:
schedule: schedule:
- cron: '18 15 * * 0' - cron: '18 15 * * 0'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs: jobs:
analyze: analyze:
name: Analyze name: Analyze

View File

@ -7,6 +7,11 @@
name: CIFuzz name: CIFuzz
on: [pull_request] on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs: jobs:
Fuzzing: Fuzzing:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -14,6 +14,10 @@ on:
release: release:
types: [ published ] types: [ published ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs: jobs:
windows_build: windows_build:
name: Windows Build (vcpkg / ${{ matrix.triplet }}) name: Windows Build (vcpkg / ${{ matrix.triplet }})

View File

@ -14,6 +14,10 @@ on:
push: push:
branches: [ "master" ] branches: [ "master" ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
# Declare default permissions as read only. # Declare default permissions as read only.
permissions: read-all permissions: read-all

View File

View File

@ -1,5 +1,10 @@
workspace(name = "org_brotli") workspace(name = "org_brotli")
local_repository(
name = "ignore_org_brotli_fuzz",
path = "c/fuzz",
)
local_repository( local_repository(
name = "ignore_org_brotli_go", name = "ignore_org_brotli_go",
path = "go", path = "go",

18
c/fuzz/.bazelrc Normal file
View File

@ -0,0 +1,18 @@
# Force the use of Clang for C++ builds.
build --action_env=CC=clang
build --action_env=CXX=clang++
# Define the --config=asan-libfuzzer configuration.
build:asan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer
build:asan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer
build:asan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_sanitizer=asan
# Define the --config=msan-libfuzzer configuration.
build:msan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer
build:msan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer
build:msan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_sanitizer=msan
# Define the --config=ubsan-libfuzzer configuration.
build:ubsan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer
build:ubsan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer
build:ubsan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_sanitizer=ubsan

12
c/fuzz/BUILD.bazel Normal file
View File

@ -0,0 +1,12 @@
load("@rules_fuzzing//fuzzing:cc_defs.bzl", "cc_fuzz_test")
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # MIT
# To start fuzzing run: bazel run --config=asan-libfuzzer //:fuzz_config_run
cc_fuzz_test(
name = "decode_fuzzer",
srcs = ["decode_fuzzer.c"],
deps = ["@org_brotli//:brotlidec"],
)

0
c/fuzz/WORKSPACE.bazel Normal file
View File