Skip to content

Commit de8431f

Browse files
authored
Initial skeleton for fuzzing infrastructure (#699)
* Initial fuzzing skeleton This commit introduces the initial skeleton for Javy's fuzzing infrastructure. This commit focuses on the `json-differential` target, to check Javy's SIMD-based, custom `JSON.parse` and `JSON.stringify` implementations. The implementation aims to take full advantage of libfuzzer's coverage capabilities and that's the reason why it uses the native version of QuickJS instead of the Wasm version. * Add README * Build fuzz targets in CI * Revert runtime configuration changes * Add `check-fuzz.yml` * Fix typo * Fix `check-fuzz` format * Add linting * Fixes * Fix formatting in check-fuzz.yml * Parametrize cargo fuzz and nightly version * Split steps to read versions * Fix typo in rustup install nightly * Fix typo in cargo install cargo-fuzz * Improve nightly installation step * Use rustup override * Drop clippy from fuzz * Fix `lint` newlines
1 parent 3f8f302 commit de8431f

File tree

13 files changed

+559
-714
lines changed

13 files changed

+559
-714
lines changed

.github/workflows/check-fuzz.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Smoke test to build fuzz targets.
2+
# Deserves its own action given that it depends on nightly
3+
# and there's currently no way to define multiple toolchains through the
4+
# `rust-toolchain.toml` configuration file.
5+
name: Build Fuzz Targets
6+
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
12+
jobs:
13+
check-fuzz:
14+
name: Build fuzz targets
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Read pinned nightly version
19+
id: nightly_version
20+
shell: bash
21+
run: |
22+
NIGHTLY_VERSION=$(cat pinned-nightly-version)
23+
echo "::set-output name=nightly_version::$NIGHTLY_VERSION"
24+
25+
- name: Read cargo fuzz version
26+
id: cargo_fuzz_version
27+
shell: bash
28+
run: |
29+
CARGO_FUZZ_VERSION=$(cat pinned-cargo-fuzz-version)
30+
echo "::set-output name=cargo_fuzz_version::$CARGO_FUZZ_VERSION"
31+
32+
- name: Install nightly
33+
run: |
34+
rustup install ${{ steps.nightly_version.outputs.nightly_version }}
35+
rustup override set ${{ steps.nightly_version.outputs.nightly_version }}
36+
rustup component add clippy
37+
38+
- name: Install cargo fuzz
39+
run: cargo install cargo-fuzz --version=${{ steps.cargo_fuzz_version.outputs.cargo_fuzz_version }}
40+
41+
- name: Build fuzz targets
42+
run: cargo fuzz build --dev

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ jobs:
4545
run: cargo test --package=javy-runner
4646

4747
- name: Lint
48-
run: cargo clippy --workspace --exclude=javy-cli --exclude=javy-runner --target=wasm32-wasi --all-targets -- -D warnings
48+
run: |
49+
cargo clippy --workspace \
50+
--exclude=javy-cli \
51+
--exclude=javy-runner \
52+
--exclude=javy-fuzz \
53+
--target=wasm32-wasi --all-targets -- -D warnings
4954
5055
# We need to specify a different job for linting `javy-runner` given that
5156
# it depends on Wasmtime and Cranelift cannot be compiled to `wasm32-wasi`

0 commit comments

Comments
 (0)