diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2024-05-16 12:56:43 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-05-16 15:38:27 +0000 |
| commit | 19e202fa8a3722f5c90ed5847edb5aeabdd5f38f (patch) | |
| tree | a528875b3c3c531b43d5a184f83ec1a04c213914 /pkg/fuzzer/fuzzer_test.go | |
| parent | e072baa2563542356ae03ad6f2057ad143979f18 (diff) | |
pkg/fuzzer: manipulate ipc.ExecOpts
There's no need in duplicating the signal, coverage, hints flags.
Diffstat (limited to 'pkg/fuzzer/fuzzer_test.go')
| -rw-r--r-- | pkg/fuzzer/fuzzer_test.go | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/pkg/fuzzer/fuzzer_test.go b/pkg/fuzzer/fuzzer_test.go index 5a903dedb..f358aacab 100644 --- a/pkg/fuzzer/fuzzer_test.go +++ b/pkg/fuzzer/fuzzer_test.go @@ -44,10 +44,12 @@ func TestFuzz(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + _, opts, _ := ipcconfig.Default(target) corpusUpdates := make(chan corpus.NewItemEvent) fuzzer := NewFuzzer(ctx, &Config{ - Debug: true, - Corpus: corpus.NewMonitoredCorpus(ctx, corpusUpdates), + Debug: true, + BaseOpts: *opts, + Corpus: corpus.NewMonitoredCorpus(ctx, corpusUpdates), Logf: func(level int, msg string, args ...interface{}) { if level > 1 { return @@ -188,10 +190,10 @@ func emulateExec(req *queue.Request) (*queue.Result, string, error) { cover := uint32(call.Meta.ID*1024) + crc32.Checksum(serializedLines[i], crc32q)%4 callInfo := ipc.CallInfo{} - if req.NeedCover { + if req.ExecOpts.ExecFlags&ipc.FlagCollectCover > 0 { callInfo.Cover = []uint32{cover} } - if req.NeedSignal != queue.NoSignal { + if req.ExecOpts.ExecFlags&ipc.FlagCollectSignal > 0 { callInfo.Signal = []uint32{cover} } info.Calls = append(info.Calls, callInfo) @@ -298,16 +300,8 @@ func newProc(t *testing.T, target *prog.Target, executor string) *executorProc { var crashRe = regexp.MustCompile(`{{CRASH: (.*?)}}`) func (proc *executorProc) execute(req *queue.Request) (*queue.Result, string, error) { - execOpts := proc.execOpts - // TODO: it's duplicated from fuzzer.go. - if req.NeedSignal != queue.NoSignal { - execOpts.ExecFlags |= ipc.FlagCollectSignal - } - if req.NeedCover { - execOpts.ExecFlags |= ipc.FlagCollectCover - } - // TODO: support req.NeedHints. - output, info, _, err := proc.env.Exec(&execOpts, req.Prog) + // TODO: support hints emulation. + output, info, _, err := proc.env.Exec(&req.ExecOpts, req.Prog) ret := crashRe.FindStringSubmatch(string(output)) if ret != nil { return nil, ret[1], nil |
