Skip to content

Commit 5c39b74

Browse files
authored
Make the fuzzing CI job faster (bytecodealliance#1727)
* CI: Only build fuzz targets, don't run them over the corpora We've only ever caught a single potential regression by running the fuzz targets over a sample of their corpora. However, this is also our slowest CI job. Running the fuzz targets over their corpora simply isn't paying for itself. Instead, just ensure that we can build the fuzz targets with `cargo fuzz` and all of the libFuzzer and sanitizer instrumentation that it enables. This will ensure that we don't break the fuzz targets, and we leave finding regressions in the fuzz corpora to oss-fuzz. * fuzz: feature gate peepmatic's fuzz targets This makes it so that the CI's fuzz target-building job doesn't build peepmatic, and transitively Z3.
1 parent 26e0629 commit 5c39b74

File tree

2 files changed

+13
-83
lines changed

2 files changed

+13
-83
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -108,95 +108,20 @@ jobs:
108108
- run: cargo check --target armv7-unknown-linux-gnueabihf -p wasi-common
109109

110110

111-
# Download our libFuzzer corpus and make sure that we can still handle all the
112-
# inputs.
113-
fuzz_corpora:
114-
name: Fuzz Corpora
111+
fuzz_targets:
112+
name: Fuzz Targets
115113
runs-on: ubuntu-latest
116114
steps:
117115
- uses: actions/checkout@v1
118116
with:
119117
submodules: true
120-
- uses: actions/checkout@v1
121-
with:
122-
repository: bytecodealliance/wasmtime-libfuzzer-corpus
123-
path: ./wasmtime/fuzz/corpus
124-
ref: refs/heads/master
125118
- uses: ./.github/actions/install-rust
126119
with:
127120
toolchain: nightly
128121
- run: cargo install cargo-fuzz --vers "^0.7"
129122
- run: cargo fetch
130123
working-directory: ./fuzz
131-
- run: cargo fuzz build --release --debug-assertions --features binaryen
132-
# Our corpora are too large to run in full on every pull request, they just
133-
# take too long. Instead, we sample some of them and make sure that running
134-
# our fuzzers over the sampled inputs still works OK.
135-
- run: |
136-
find fuzz/corpus/compile -type f \
137-
| shuf -n 3000 \
138-
| xargs cargo fuzz run compile --release --debug-assertions --features binaryen
139-
env:
140-
RUST_BACKTRACE: 1
141-
- run: |
142-
find fuzz/corpus/instantiate -type f \
143-
| shuf -n 2000 \
144-
| xargs cargo fuzz run instantiate --release --debug-assertions --features binaryen
145-
env:
146-
RUST_BACKTRACE: 1
147-
- run: |
148-
find fuzz/corpus/instantiate_translated -type f \
149-
| shuf -n 1000 \
150-
| xargs cargo fuzz run instantiate_translated --release --debug-assertions --features binaryen
151-
env:
152-
RUST_BACKTRACE: 1
153-
- run: |
154-
find fuzz/corpus/api_calls -type f \
155-
| shuf -n 100 \
156-
| xargs cargo fuzz run api_calls --release --debug-assertions --features binaryen
157-
env:
158-
RUST_BACKTRACE: 1
159-
- run: |
160-
find fuzz/corpus/differential -type f \
161-
| shuf -n 100 \
162-
| xargs cargo fuzz run differential --release --debug-assertions --features binaryen
163-
env:
164-
RUST_BACKTRACE: 1
165-
- run: |
166-
find fuzz/corpus/peepmatic_compile -type f \
167-
| shuf \
168-
| head -n 10000 \
169-
| xargs cargo fuzz run peepmatic_compile --release --debug-assertions --features binaryen
170-
env:
171-
RUST_BACKTRACE: 1
172-
- run: |
173-
find fuzz/corpus/peepmatic_fst_differential -type f \
174-
| shuf \
175-
| head -n 10000 \
176-
| xargs cargo fuzz run peepmatic_fst_differential --release --debug-assertions --features binaryen
177-
env:
178-
RUST_BACKTRACE: 1
179-
- run: |
180-
find fuzz/corpus/peepmatic_interp -type f \
181-
| shuf \
182-
| head -n 5000 \
183-
| xargs cargo fuzz run peepmatic_interp --release --debug-assertions --features binaryen
184-
env:
185-
RUST_BACKTRACE: 1
186-
- run: |
187-
find fuzz/corpus/peepmatic_parser -type f \
188-
| shuf \
189-
| head -n 10000 \
190-
| xargs cargo fuzz run peepmatic_parser --release --debug-assertions --features binaryen
191-
env:
192-
RUST_BACKTRACE: 1
193-
- run: |
194-
find fuzz/corpus/peepmatic_simple_automata -type f \
195-
| shuf \
196-
| head -n 1000 \
197-
| xargs cargo fuzz run peepmatic_simple_automata --release --debug-assertions --features binaryen
198-
env:
199-
RUST_BACKTRACE: 1
124+
- run: cargo fuzz build --features binaryen
200125

201126
rebuild_peephole_optimizers:
202127
name: Rebuild Peephole Optimizers

fuzz/Cargo.toml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cranelift-reader = { path = "../cranelift/reader" }
1414
cranelift-wasm = { path = "../cranelift/wasm" }
1515
libfuzzer-sys = "0.3.2"
1616
target-lexicon = "0.10"
17-
peepmatic-fuzzing = { path = "../cranelift/peepmatic/crates/fuzzing" }
17+
peepmatic-fuzzing = { path = "../cranelift/peepmatic/crates/fuzzing", optional = true }
1818
wasmtime = { path = "../crates/wasmtime" }
1919
wasmtime-fuzzing = { path = "../crates/fuzzing" }
2020

@@ -35,21 +35,21 @@ name = "instantiate_translated"
3535
path = "fuzz_targets/instantiate_translated.rs"
3636
test = false
3737
doc = false
38-
required-features = ['binaryen']
38+
required-features = ["binaryen"]
3939

4040
[[bin]]
4141
name = "api_calls"
4242
path = "fuzz_targets/api_calls.rs"
4343
test = false
4444
doc = false
45-
required-features = ['binaryen']
45+
required-features = ["binaryen"]
4646

4747
[[bin]]
4848
name = "differential"
4949
path = "fuzz_targets/differential.rs"
5050
test = false
5151
doc = false
52-
required-features = ['binaryen']
52+
required-features = ["binaryen"]
5353

5454
[[bin]]
5555
name = "spectests"
@@ -62,30 +62,35 @@ name = "peepmatic_simple_automata"
6262
path = "fuzz_targets/peepmatic_simple_automata.rs"
6363
test = false
6464
doc = false
65+
required-features = ["peepmatic-fuzzing"]
6566

6667
[[bin]]
6768
name = "peepmatic_fst_differential"
6869
path = "fuzz_targets/peepmatic_fst_differential.rs"
6970
test = false
7071
doc = false
72+
required-features = ["peepmatic-fuzzing"]
7173

7274
[[bin]]
7375
name = "peepmatic_parser"
7476
path = "fuzz_targets/peepmatic_parser.rs"
7577
test = false
7678
doc = false
79+
required-features = ["peepmatic-fuzzing"]
7780

7881
[[bin]]
7982
name = "peepmatic_compile"
8083
path = "fuzz_targets/peepmatic_compile.rs"
8184
test = false
8285
doc = false
86+
required-features = ["peepmatic-fuzzing"]
8387

8488
[[bin]]
8589
name = "peepmatic_interp"
8690
path = "fuzz_targets/peepmatic_interp.rs"
8791
test = false
8892
doc = false
93+
required-features = ["peepmatic-fuzzing"]
8994

9095
[features]
91-
binaryen = ['wasmtime-fuzzing/binaryen']
96+
binaryen = ["wasmtime-fuzzing/binaryen"]

0 commit comments

Comments
 (0)