Skip to content

Commit

Permalink
💚 test fuzzing pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
lukacan committed Jun 26, 2024
1 parent 9fa4623 commit bf8d965
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .github/actions/setup-honggfuzz/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Setup Honggfuzz"
description: "Setup Honggfuzz"

runs:
using: "composite"
steps:
- uses: actions/cache@v3
name: Cache Honggfuzz
id: cache-honggfuzz
with:
path: |
~/.cache/honggfuzz/
~/.local/share/honggfuzz/
key: honggfuzz-${{ runner.os }}-v0000-${{ env.HONGGFUZZ_VERSION }}
- name: Install honggfuzz
run: cargo install honggfuzz --version ${{ env.HONGGFUZZ_VERSION }}
shell: bash
- name: Install binutils-dev
run: sudo apt-get install binutils-dev
shell: bash
- name: Install libunwind-dev
run: sudo apt-get install libunwind-dev
shell: bash
25 changes: 25 additions & 0 deletions .github/workflows/run_fuzz_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test Fuzz Tests

on:
workflow_dispatch:
pull_request:

env:
SOLANA_CLI_VERSION: 1.18.12
ANCHOR_VERSION: 0.29.0
HONGGFUZZ_VERSION: 0.5.55

jobs:
run_fuzz_example:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust/
- uses: ./.github/actions/setup-solana/
- uses: ./.github/actions/setup-honggfuzz/
id: rust-setup
- uses: Swatinem/rust-cache@v2
name: Cache Rust and it's packages
- name: Test Fuzz
working-directory: examples/fuzz-tests/unchecked-arithmetic-0
run: HFUZZ_RUN_ARGS="-N 10" cargo run --manifest-path ../../../Cargo.toml fuzz run fuzz_0
7 changes: 3 additions & 4 deletions crates/client/src/commander.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl Commander {
"The crash directory {} contains new fuzz test crashes. Exiting!",
crash_dir.to_string_lossy()
);
process::exit(1);
process::exit(99);
}
}
}
Expand Down Expand Up @@ -292,7 +292,7 @@ impl Commander {
res = child.wait() =>
match res {
Ok(status) => if !status.success() {
println!("Honggfuzz exited with an error!");
throw!(Error::FuzzingFailed);
},
Err(_) => throw!(Error::FuzzingFailed),
},
Expand Down Expand Up @@ -358,7 +358,7 @@ impl Commander {
match res {
Ok(status) => {
if !status.success() {
println!("Honggfuzz exited with an error!");
throw!(Error::FuzzingFailed);
}
},
Err(_) => throw!(Error::FuzzingFailed),
Expand All @@ -367,7 +367,6 @@ impl Commander {
_ = signal::ctrl_c() => {
fuzz_end.store(true, std::sync::atomic::Ordering::SeqCst);
tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;

},
}
let stats_result = stats_handle
Expand Down

0 comments on commit bf8d965

Please sign in to comment.