-
Notifications
You must be signed in to change notification settings - Fork 22
Add fuzz tests to ci #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add fuzz tests to ci #156
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,6 +108,48 @@ jobs: | |
| - run: make proto-fmt | ||
| - run: make check-protos check-api-descriptors | ||
|
|
||
| # | ||
| # Unit tests | ||
| # | ||
| tests: | ||
| name: Unit Tests | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version-file: '.github/.tool-versions' | ||
| - name: Run unit tests | ||
| run: go test -race -count=1 $(go list ./... | grep -v /integration) | ||
|
|
||
| # | ||
| # Fuzz tests | ||
| # | ||
| fuzz: | ||
| name: Fuzz Tests | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version-file: '.github/.tool-versions' | ||
| - name: Run all fuzz tests | ||
| run: | | ||
| # Find all packages containing fuzz tests and run each target. | ||
| # go test -fuzz only accepts one package at a time and one | ||
| # matching fuzz target, so we discover and iterate. | ||
| grep -r --include='*_test.go' -l '^func Fuzz' . | while read -r file; do | ||
| pkg=$(dirname "$file") | ||
| grep -o '^func Fuzz[A-Za-z0-9_]*' "$file" | sed 's/^func //' | while read -r target; do | ||
| echo "=== Fuzzing ${target} in ${pkg} ===" | ||
| go test "${pkg}" -fuzz="^${target}$" -fuzztime=60s | ||
| done | ||
| done | ||
|
Comment on lines
+145
to
+151
|
||
|
|
||
| # | ||
| # Build kernels on cache miss | ||
| # | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grep -r ... .will recursively scan everything in the checkout (including.git/and any vendored/generated directories), which can be slow and may produce false positives. Prefer restricting discovery to tracked Go test files (e.g., viagit ls-files '*_test.go') and/or explicitly excluding.git,vendor, and_outputfrom the search.