Skip to content

Commit

Permalink
fix fuzzing tests broken by API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Feb 25, 2024
1 parent c6b0678 commit b27d697
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion fuzz/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ func FuzzCheck(data []byte) int {
actionlint.NewRuleMatrix(),
actionlint.NewRuleCredentials(),
actionlint.NewRuleShellName(),
actionlint.NewRuleRunnerLabel([]string{}),
actionlint.NewRuleRunnerLabel(),
actionlint.NewRuleEvents(),
actionlint.NewRuleGlob(),
actionlint.NewRuleJobNeeds(),
actionlint.NewRuleAction(ac),
actionlint.NewRuleEnvVar(),
actionlint.NewRuleID(),
actionlint.NewRuleExpression(ac, wc),
actionlint.NewRuleWorkflowCall("test.yaml", wc),
actionlint.NewRulePermissions(),
actionlint.NewRuleDeprecatedCommands(),
actionlint.NewRuleIfCond(),
}

v := actionlint.NewVisitor()
Expand Down
2 changes: 1 addition & 1 deletion fuzz/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func FuzzExprParse(data []byte) int {
return 0
}

c := actionlint.NewExprSemanticsChecker(true)
c := actionlint.NewExprSemanticsChecker(true, nil)
c.Check(e)

return 1
Expand Down
3 changes: 2 additions & 1 deletion fuzz/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import (
)

func canParseByGoYAML(data []byte) (ret bool) {
ret = true
defer func() {
if err := recover(); err != nil {
ret = false
}
}()
var n yaml.Node
yaml.Unmarshal(data, &n)
return true
return
}

func FuzzParse(data []byte) int {
Expand Down

0 comments on commit b27d697

Please sign in to comment.