Skip to content

test: add fuzz targets for config and linter - #1956

Open
mfederowicz wants to merge 4 commits into
revive-lint:masterfrom
mfederowicz:test/fuzz-targets
Open

mfederowicz wants to merge 4 commits into
revive-lint:masterfrom
mfederowicz:test/fuzz-targets

Conversation

@mfederowicz

Copy link
Copy Markdown
Contributor

Updates #1935

Adds Go native fuzz targets (detected by Scorecard's Fuzzing check):

  • FuzzGetConfig (config/) — loads arbitrary TOML via config.GetConfig and configures every rule with the fuzzed arguments via GetLintingRules.
  • FuzzLint (test/) — runs all rules over arbitrary Go source (in-memory reader).

Both only assert that nothing panics. In go test ./... they run just their seed corpus (~0.2s). To fuzz locally:

go test -run='^$' -fuzz=FuzzGetConfig -fuzztime=1m ./config/
go test -run='^$' -fuzz=FuzzLint -fuzztime=1m ./test/

A 1-minute run of each found no crashes.

@alexandear

Copy link
Copy Markdown
Member

@mfederowicz thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants