diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 81ceff81..d698a68c 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -1,15 +1,12 @@ name: Fuzz -# Temporarily disable job until someone works out how to fix honggfuzz. -on: [] +on: [push, pull_request] jobs: fuzz: if: ${{ !github.event.act }} runs-on: ubuntu-20.04 - env: - HFUZZ_BUILD_ARGS: "--features honggfuzz_fuzz" strategy: fail-fast: false matrix: @@ -31,11 +28,8 @@ jobs: toolchain: 1.58 override: true profile: minimal - - run: cargo install honggfuzz - if: steps.cache-fuzz.outputs.cache-hit != 'true' - - run: echo "HFUZZ_RUN_ARGS=\"--run_time 30 --exit_upon_crash -v -f hfuzz_input/${{ matrix.fuzz_target }}/input\"" >> $GITHUB_ENV - name: fuzz - run: cd fuzz && cargo hfuzz run ${{ matrix.fuzz_target }} + run: cd fuzz && ./travis-fuzz.sh "${{ matrix.fuzz_target }}" - run: echo "${{ matrix.fuzz_target }}.rs" >executed_${{ matrix.fuzz_target }} - uses: actions/upload-artifact@v2 with: diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index b893483b..927a3b37 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -12,7 +12,7 @@ afl_fuzz = ["afl"] honggfuzz_fuzz = ["honggfuzz"] [dependencies] -honggfuzz = { version = "0.5", optional = true } +honggfuzz = { version = "0.5", optional = true, default-features = false } afl = { version = "0.4", optional = true } bitcoin = { path = ".." } diff --git a/fuzz/travis-fuzz.sh b/fuzz/travis-fuzz.sh index 8f699815..1f75c9c0 100755 --- a/fuzz/travis-fuzz.sh +++ b/fuzz/travis-fuzz.sh @@ -8,9 +8,19 @@ if [ ${incorrectFilenames} -gt 0 ]; then exit 2 fi +if [ "$1" == "" ]; then + TARGETS=fuzz_targets/* +else + TARGETS=fuzz_targets/"$1".rs +fi + +cargo --version +rustc --version + # Testing -cargo install --force honggfuzz -for TARGET in fuzz_targets/*; do +cargo install --force honggfuzz --no-default-features +for TARGET in $TARGETS; do + echo "Fuzzing target $TARGET" FILENAME=$(basename $TARGET) FILE="${FILENAME%.*}" if [ -d hfuzz_input/$FILE ]; then