Skip to content

Commit

Permalink
CI: build and run our fuzz targets
Browse files Browse the repository at this point in the history
This builds them in one job, and then spawns N parallel jobs to run each built
fuzz target for five minutes.
  • Loading branch information
fitzgen committed May 19, 2020
1 parent c81ecb6 commit 7087889
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,50 @@ jobs:
$(find ./target/debug -type f -perm -100 | grep gimli | head -n 1) \
> /dev/null
build_fuzz_targets:
name: Build fuzz targets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
- name: Install nightly rust
run: |
rustup install nightly
rustup default nightly
- name: Install `cargo fuzz`
run: cargo install cargo-fuzz --vers "^0.7.4"
- run: cargo fuzz build -Oa
- uses: actions/upload-artifact@v1
with:
name: fuzz-targets
path: fuzz/target/x86_64-unknown-linux-gnu/release/debug_*
- uses: actions/upload-artifact@v1
with:
name: fuzz-targets
path: fuzz/target/x86_64-unknown-linux-gnu/release/eh_*

run_fuzz_targets:
strategy:
matrix:
fuzz_target: ["debug_abbrev", "debug_aranges", "debug_info", "debug_line", "eh_frame", "eh_frame_hdr"]
name: "Run `${{matrix.fuzz_target}}` fuzz target"
needs: build_fuzz_targets
runs-on: ubuntu-latest
steps:
- name: Clone the fuzz corpora
uses: actions/checkout@v2
with:
repository: gimli-rs/gimli-libfuzzer-corpora
path: corpora
- name: Download fuzz targets
uses: actions/download-artifact@v1
with:
name: fuzz-targets
- name: "Run `${{matrix.fuzz_target}}` fuzz target"
# Note: 300 seconds = 5 minutes.
run: ./${{matrix.fuzz_target}} ./corpora/${{matrix.fuzz_target}} -max_total_time=300

features:
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 7087889

Please sign in to comment.