Skip to content

Commit be17c9c

Browse files
committed
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.
1 parent a9d6a79 commit be17c9c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pkg/manager/diff.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"fmt"
1111
"math/rand"
1212
"net"
13+
"regexp"
1314
"sort"
1415
"strings"
1516
"sync"
@@ -817,11 +818,15 @@ func PatchFocusAreas(cfg *mgrconfig.Config, gitPatches [][]byte, baseHashes, pat
817818
funcs := modifiedSymbols(baseHashes, patchedHashes)
818819
if len(funcs) > 0 {
819820
log.Logf(0, "adding modified_functions to focus areas: %q", funcs)
821+
var regexps []string
822+
for _, name := range funcs {
823+
regexps = append(regexps, fmt.Sprintf("^%s$", regexp.QuoteMeta(name)))
824+
}
820825
cfg.Experimental.FocusAreas = append(cfg.Experimental.FocusAreas,
821826
mgrconfig.FocusArea{
822827
Name: symbolsArea,
823828
Filter: mgrconfig.CovFilterCfg{
824-
Functions: funcs,
829+
Functions: regexps,
825830
},
826831
Weight: 6.0,
827832
})

pkg/manager/diff_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ index 103167d..fbf7a68 100644
5555
{
5656
Name: symbolsArea,
5757
Filter: mgrconfig.CovFilterCfg{
58-
Functions: []string{"function"},
58+
Functions: []string{"^function$"},
5959
},
6060
Weight: 6.0,
6161
},

0 commit comments

Comments
 (0)