Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to cargo-fuzz #261

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 37 additions & 17 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

jobs:
fuzz:
name: Run Fuzz Target
if: ${{ !github.event.act }}
runs-on: ubuntu-latest
strategy:
Expand All @@ -22,38 +23,57 @@ decode_program,
parse_human,
]
steps:
- name: Install test dependencies
run: sudo apt-get update -y && sudo apt-get install -y binutils-dev libunwind8-dev libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc libiberty-dev
- uses: actions/checkout@v4
- uses: actions/cache@v3
- name: Checkout Crate
uses: actions/checkout@v4

- name: Use Rust Cache
uses: actions/cache@v4
id: cache-fuzz
with:
path: |
~/.cargo/bin
fuzz/target
target
key: cache-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- uses: dtolnay/rust-toolchain@stable

- name: Install Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: '1.65.0'
- name: fuzz
run: |
echo "Using RUSTFLAGS $RUSTFLAGS"
cd fuzz && cargo update && cargo update -p cc --precise 1.0.83 && ./fuzz.sh "${{ matrix.fuzz_target }}"
- run: echo "${{ matrix.fuzz_target }}" >executed_${{ matrix.fuzz_target }}
- uses: actions/upload-artifact@v3
toolchain: nightly-2024-07-01
components: "llvm-tools-preview"

- name: Install Dependencies
run: cargo update && cargo update -p cc --precise 1.0.83 && cargo install cargo-fuzz

- name: Run Fuzz Target
run: ./fuzz/fuzz.sh "${{ matrix.fuzz_target }}"

- name: Prepare Artifact
run: echo "${{ matrix.fuzz_target }}" >executed_${{ matrix.fuzz_target }}

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: executed_${{ matrix.fuzz_target }}
path: executed_${{ matrix.fuzz_target }}

verify-execution:
name: Verify Execution of All Targets
if: ${{ !github.event.act }}
needs: fuzz
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- name: Display structure of downloaded files
- name: Checkout Crate
uses: actions/checkout@v4

- name: Download All Artifacts
uses: actions/download-artifact@v4

- name: Display Structure of Downloaded Files
run: ls -R
- run: find executed_* -type f -exec cat {} + | sort > executed
- run: source ./fuzz/fuzz-util.sh && listTargetNames | sort | diff - executed

- name: Write File With All Executed Targets
run: find executed_* -type f -exec cat {} + | sort > executed

- name: Compare Executed Targets With Available Targets
run: source ./fuzz/fuzz-util.sh && listTargetNames | sort | diff - executed
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Cargo.lock
#fuzz
fuzz/hfuzz_target
fuzz/hfuzz_workspace
fuzz/artifacts
fuzz/corpus

#IntelliJ project files
.idea
Expand Down
Loading
Loading