Skip to content

Commit 10de7d7

Browse files
committed
Run a bounded fuzz smoke test in CI
1 parent c00de08 commit 10de7d7

6 files changed

Lines changed: 71 additions & 15 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,26 @@ jobs:
102102
- run: sudo apt-get update && sudo apt-get install -y unixodbc-dev
103103
- run: cargo package --locked --allow-dirty
104104

105+
fuzz_smoke:
106+
needs: ci_selection
107+
if: needs.ci_selection.outputs.full == 'true'
108+
runs-on: ubuntu-latest
109+
timeout-minutes: 10
110+
env:
111+
FUZZ_TOOLCHAIN: nightly-2026-10-21
112+
steps:
113+
- uses: actions/checkout@v7
114+
- uses: ./.github/actions/install-frontend-dependencies
115+
- run: rustup toolchain install "$FUZZ_TOOLCHAIN" --profile minimal --component rust-src
116+
- name: Set up cargo cache
117+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
118+
with:
119+
shared-key: rust-sqlpage-fuzz
120+
workspaces: fuzz -> target
121+
save-if: ${{ github.ref == 'refs/heads/main' }}
122+
- run: cargo install cargo-fuzz --locked --version 0.13.2
123+
- run: scripts/run-fuzz-smoke.sh
124+
105125
test:
106126
runs-on: ubuntu-latest
107127
needs: compile_and_lint
@@ -473,6 +493,7 @@ jobs:
473493
- ci_selection
474494
- compile_and_lint
475495
- published_crate
496+
- fuzz_smoke
476497
- test
477498
- windows_test
478499
- playwright

‎fuzz/Cargo.lock‎

Lines changed: 16 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎fuzz/README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ PY
3232
The 16 KiB limit is a starting point for efficient mutation, not a parser limit.
3333
The harness also accepts larger inputs. The same cargo-fuzz target is used by
3434
OSS-Fuzz and by OSS Verify's static RISC-V adapter.
35+
36+
For the bounded, deterministic smoke run used by CI:
37+
38+
```sh
39+
scripts/run-fuzz-smoke.sh
40+
```

‎scripts/check-ci-results.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ if (full === "true") {
2828
for (const name of [
2929
"compile_and_lint",
3030
"published_crate",
31+
"fuzz_smoke",
3132
"test",
3233
"windows_test",
3334
"playwright",

‎scripts/run-fuzz-smoke.sh‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
cd "$(dirname "${BASH_SOURCE[0]}")/.."
5+
6+
corpus_dir="$(mktemp -d)"
7+
trap 'rm -rf "$corpus_dir"' EXIT
8+
9+
python3 - "$corpus_dir" <<'PY'
10+
import sys
11+
from pathlib import Path
12+
13+
corpus = Path(sys.argv[1])
14+
for index, source in enumerate(sorted(Path("tests/sql_test_files").rglob("*.sql"))):
15+
for selector in range(16):
16+
(corpus / f"{index}-{selector}").write_bytes(
17+
bytes([selector]) + source.read_bytes()
18+
)
19+
PY
20+
21+
toolchain="${FUZZ_TOOLCHAIN:-nightly}"
22+
cargo "+${toolchain}" fuzz run --dev sql_file "$corpus_dir" -- \
23+
-runs=4096 \
24+
-seed=1 \
25+
-max_len=16384 \
26+
-timeout=5

‎tests/js/ci_gate.spec.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const root = fileURLToPath(new URL("../../", import.meta.url));
88
const coreJobs = [
99
"compile_and_lint",
1010
"published_crate",
11+
"fuzz_smoke",
1112
"test",
1213
"windows_test",
1314
"playwright",

0 commit comments

Comments
 (0)