From fe2b7c2e766735bba9465a2ed36337309777bcf3 Mon Sep 17 00:00:00 2001 From: Tpt Date: Thu, 29 Dec 2022 21:07:35 +0100 Subject: [PATCH] Attempt to setup clusterfuzzlite --- .clusterfuzzlite/Dockerfile | 5 +++ .clusterfuzzlite/build.sh | 4 ++ .clusterfuzzlite/project.yaml | 1 + .github/workflows/tests.yml | 77 +++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 .clusterfuzzlite/Dockerfile create mode 100644 .clusterfuzzlite/build.sh create mode 100644 .clusterfuzzlite/project.yaml diff --git a/.clusterfuzzlite/Dockerfile b/.clusterfuzzlite/Dockerfile new file mode 100644 index 00000000..9cd00b1d --- /dev/null +++ b/.clusterfuzzlite/Dockerfile @@ -0,0 +1,5 @@ +FROM gcr.io/oss-fuzz-base/base-builder-rust:v1 +RUN apt-get update && apt-get install -y llvm-dev libclang-dev clang && apt-get clean && rm --recursive --force /var/lib/apt/lists/* +COPY . $SRC/oxigraph +WORKDIR oxigraph +COPY .clusterfuzzlite/build.sh $SRC/ diff --git a/.clusterfuzzlite/build.sh b/.clusterfuzzlite/build.sh new file mode 100644 index 00000000..a18573bf --- /dev/null +++ b/.clusterfuzzlite/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash -eu +cd $SRC/oxigraph +cargo fuzz build -O --debug-assertions +cp fuzz/target/x86_64-unknown-linux-gnu/release/sparql_eval $OUT/ diff --git a/.clusterfuzzlite/project.yaml b/.clusterfuzzlite/project.yaml new file mode 100644 index 00000000..22761ba7 --- /dev/null +++ b/.clusterfuzzlite/project.yaml @@ -0,0 +1 @@ +language: rust diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 32c85291..d15dad13 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -148,3 +148,80 @@ jobs: - run: pip install ./python - run: python -m unittest working-directory: ./python/tests + + fuzz_changes: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - uses: google/clusterfuzzlite/actions/build_fuzzers@v1 + with: + language: rust + github-token: ${{ secrets.GITHUB_TOKEN }} + sanitizer: address + storage-repo: https://${{ secrets.FULL_ACCESS_TOKEN }}@github.com/oxigraph/clusterfuzzlite-oxigraph.git + - uses: google/clusterfuzzlite/actions/run_fuzzers@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + fuzz-seconds: 600 + mode: 'code-change' + sanitizer: address + storage-repo: https://${{ secrets.FULL_ACCESS_TOKEN }}@github.com/oxigraph/clusterfuzzlite-oxigraph.git + + fuzz_repo: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - uses: google/clusterfuzzlite/actions/build_fuzzers@v1 + with: + language: rust + github-token: ${{ secrets.GITHUB_TOKEN }} + sanitizer: address + - uses: google/clusterfuzzlite/actions/run_fuzzers@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + fuzz-seconds: 3600 + mode: 'batch' + sanitizer: address + storage-repo: https://${{ secrets.FULL_ACCESS_TOKEN }}@github.com/oxigraph/clusterfuzzlite-oxigraph.git + + fuzz_prune: + if: github.event_name != 'pull_request' + needs: fuzz_repo + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - uses: google/clusterfuzzlite/actions/build_fuzzers@v1 + with: + language: rust + github-token: ${{ secrets.GITHUB_TOKEN }} + - uses: google/clusterfuzzlite/actions/run_fuzzers@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + fuzz-seconds: 600 + mode: 'prune' + storage-repo: https://${{ secrets.FULL_ACCESS_TOKEN }}@github.com/oxigraph/clusterfuzzlite-oxigraph.git + + fuzz_coverage: + if: github.event_name != 'pull_request' + needs: fuzz_prune + runs-on: ubuntu-latest + steps: + - uses: google/clusterfuzzlite/actions/build_fuzzers@v1 + with: + language: rust + sanitizer: coverage + - uses: google/clusterfuzzlite/actions/run_fuzzers@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + fuzz-seconds: 600 + mode: 'coverage' + sanitizer: 'coverage' + storage-repo: https://${{ secrets.FULL_ACCESS_TOKEN }}@github.com/oxigraph/clusterfuzzlite-oxigraph.git