Skip to content

Commit c936db1

Browse files
Port new fuzzer to v1 (#678)
* Port new fuzzer to v1 * Just copy the workflows from v2 (probably won't work) * Add iai-callgrind as a dev-dependency * Add callgrind profile * Add callgrind benches * Change fuzz back to edition = "2018" * Update the right version this time * Change fuzz edition back to 2018 * Remove callgrind benches * Fix tests on MSRV * Didn't mean to commit that * Port #680 * Change fuzz dependency syntax
1 parent ccf5fc7 commit c936db1

14 files changed

Lines changed: 504 additions & 637 deletions

File tree

‎.github/workflows/checks.yml‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: checks
2+
on:
3+
pull_request:
4+
merge_group:
5+
types: [checks_requested]
6+
workflow_dispatch:
7+
jobs:
8+
benchmarks:
9+
name: Benchmarks
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: checkout
13+
uses: actions/checkout@v7
14+
- name: install rust nightly
15+
uses: dtolnay/rust-toolchain@nightly
16+
- name: default features
17+
run: cargo bench --no-run
18+
- name: all features
19+
run: cargo bench --all-features --no-run
20+
practices:
21+
name: Practices
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: checkout
25+
uses: actions/checkout@v7
26+
- name: install rust nightly
27+
uses: dtolnay/rust-toolchain@nightly
28+
- name: style
29+
run: |
30+
rustup component add rustfmt
31+
cargo fmt --all --check
32+
- name: clippy
33+
run: |
34+
rustup component add clippy
35+
cargo clippy
36+
- name: docs
37+
run: cargo doc --all-features
38+
miri:
39+
name: Miri
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: checkout
43+
uses: actions/checkout@v7
44+
- name: install rust nightly
45+
uses: dtolnay/rust-toolchain@nightly
46+
- name: default features
47+
run: |
48+
rustup component add miri
49+
cargo miri test
50+
- name: all features
51+
run: cargo miri test --all-features
52+
stable:
53+
name: Stable
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: checkout
57+
uses: actions/checkout@v7
58+
- name: install rust nightly
59+
uses: dtolnay/rust-toolchain@stable
60+
- name: test default features
61+
run: cargo test
62+
nightly:
63+
name: Nightly
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: checkout
67+
uses: actions/checkout@v7
68+
- name: install rust nightly
69+
uses: dtolnay/rust-toolchain@nightly
70+
- name: test default features
71+
run: cargo test
72+
- name: test all features
73+
run: cargo test --all-features
74+
nostd:
75+
name: NoStd
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: checkout
79+
uses: actions/checkout@v7
80+
- name: install rust stable
81+
uses: dtolnay/rust-toolchain@stable
82+
with:
83+
target: thumbv7m-none-eabi
84+
- name: test default features
85+
run: cargo test
86+
msrv:
87+
name: MSRV
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: checkout
91+
uses: actions/checkout@v7
92+
- name: install rust MSRV
93+
uses: dtolnay/rust-toolchain@1.36
94+
- name: test default features
95+
run: cargo test

‎.github/workflows/fuzzing.yml‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: fuzzing
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
jobs:
7+
fuzz:
8+
name: Fuzz
9+
if: github.repository == 'servo/rust-smallvec'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: checkout
13+
uses: actions/checkout@v7
14+
- name: install rust nightly
15+
uses: dtolnay/rust-toolchain@nightly
16+
- name: restore corpus
17+
uses: actions/cache/restore@v6
18+
with:
19+
path: fuzz/corpus
20+
key: fuzz-corpus-${{ github.run_id }}
21+
restore-keys: |
22+
fuzz-corpus-
23+
- name: fuzz
24+
run: |
25+
cargo install cargo-fuzz
26+
set -e
27+
for i in {1..6}; do
28+
cargo fuzz run main -- -max_total_time=300 -rss_limit_mb=4096
29+
done
30+
- name: minimize corpus
31+
if: always()
32+
run: cargo fuzz cmin main
33+
- name: save corpus
34+
if: always()
35+
uses: actions/cache/save@v6
36+
with:
37+
path: fuzz/corpus
38+
key: fuzz-corpus-${{ github.run_id }}

‎.github/workflows/main.yml‎

Lines changed: 0 additions & 111 deletions
This file was deleted.

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
target
22
/Cargo.lock
3-
/fuzz/hfuzz_target
43
/.vscode

‎Cargo.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ bincode1 = { package = "bincode", version = "1.0.1" }
3535
[package.metadata.docs.rs]
3636
all-features = true
3737
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
38+
39+
[workspace]
40+
members = [
41+
".",
42+
"fuzz",
43+
]

‎fuzz/.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
target
2+
corpus
3+
artifacts
4+
coverage

0 commit comments

Comments
 (0)