diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2026-01-14 13:18:19 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2026-01-14 14:21:50 +0000 |
| commit | be17c9cc24473b811d7b23ba61b6304aa4558fd6 (patch) | |
| tree | 7dfcbca79c1953da0b037184bf3549dbdce138fe | |
| parent | a9d6a79219801d2130df3b1a792c57f0e5428e9f (diff) | |
pkg/manager: match full function names in focus areas
When configuring focus areas before directed fuzzing, construct regular
expressions that match the exact function names. Otherwise, we end up
adding more functions than intended.
| -rw-r--r-- | pkg/manager/diff.go | 7 | ||||
| -rw-r--r-- | pkg/manager/diff_test.go | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/pkg/manager/diff.go b/pkg/manager/diff.go index 88710a59b..f972748d3 100644 --- a/pkg/manager/diff.go +++ b/pkg/manager/diff.go @@ -10,6 +10,7 @@ import ( "fmt" "math/rand" "net" + "regexp" "sort" "strings" "sync" @@ -817,11 +818,15 @@ func PatchFocusAreas(cfg *mgrconfig.Config, gitPatches [][]byte, baseHashes, pat funcs := modifiedSymbols(baseHashes, patchedHashes) if len(funcs) > 0 { log.Logf(0, "adding modified_functions to focus areas: %q", funcs) + var regexps []string + for _, name := range funcs { + regexps = append(regexps, fmt.Sprintf("^%s$", regexp.QuoteMeta(name))) + } cfg.Experimental.FocusAreas = append(cfg.Experimental.FocusAreas, mgrconfig.FocusArea{ Name: symbolsArea, Filter: mgrconfig.CovFilterCfg{ - Functions: funcs, + Functions: regexps, }, Weight: 6.0, }) diff --git a/pkg/manager/diff_test.go b/pkg/manager/diff_test.go index 9c17361d5..a73c31ffb 100644 --- a/pkg/manager/diff_test.go +++ b/pkg/manager/diff_test.go @@ -55,7 +55,7 @@ index 103167d..fbf7a68 100644 { Name: symbolsArea, Filter: mgrconfig.CovFilterCfg{ - Functions: []string{"function"}, + Functions: []string{"^function$"}, }, Weight: 6.0, }, |
