diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2024-03-13 18:52:18 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-03-18 10:58:52 +0000 |
| commit | fc090d205d8c3d58f190659a98795d89421b7e6b (patch) | |
| tree | 2b33cca3e6366a1565d70fdce01a51d6e50f6448 /pkg/fuzzer/fuzzer_test.go | |
| parent | d615901c739a765329b688494cee2f8e1b5037cb (diff) | |
pkg/corpus: a separate package for the corpus functionality
pkg/fuzzer and syz-manager have a common corpus functionality that can
be well be unified.
Create a separate pkg/corpus package that would be used by both of them.
It will simplify further work of moving pkg/fuzzer to the host.
Diffstat (limited to 'pkg/fuzzer/fuzzer_test.go')
| -rw-r--r-- | pkg/fuzzer/fuzzer_test.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pkg/fuzzer/fuzzer_test.go b/pkg/fuzzer/fuzzer_test.go index 1896b2b84..7000bb062 100644 --- a/pkg/fuzzer/fuzzer_test.go +++ b/pkg/fuzzer/fuzzer_test.go @@ -18,10 +18,10 @@ import ( "testing" "time" + "github.com/google/syzkaller/pkg/corpus" "github.com/google/syzkaller/pkg/csource" "github.com/google/syzkaller/pkg/ipc" "github.com/google/syzkaller/pkg/ipc/ipcconfig" - "github.com/google/syzkaller/pkg/rpctype" "github.com/google/syzkaller/pkg/testutil" "github.com/google/syzkaller/prog" "github.com/google/syzkaller/sys/targets" @@ -41,7 +41,8 @@ func TestFuzz(t *testing.T) { defer cancel() fuzzer := NewFuzzer(ctx, &Config{ - Debug: true, + Debug: true, + Corpus: corpus.NewCorpus(ctx), Logf: func(level int, msg string, args ...interface{}) { if level > 1 { return @@ -52,7 +53,7 @@ func TestFuzz(t *testing.T) { EnabledCalls: map[*prog.Syscall]bool{ target.SyscallMap["syz_test_fuzzer1"]: true, }, - NewInputs: make(chan rpctype.Input), + NewInputs: make(chan corpus.NewInput), }, rand.New(testutil.RandSource(t)), target) go func() { @@ -77,7 +78,7 @@ func TestFuzz(t *testing.T) { tf.wait() t.Logf("resulting corpus:") - for _, p := range fuzzer.Corpus.Programs() { + for _, p := range fuzzer.Config.Corpus.Programs() { t.Logf("-----") t.Logf("%s", p.Serialize()) } @@ -99,6 +100,7 @@ func BenchmarkFuzzer(b *testing.B) { calls[c] = true } fuzzer := NewFuzzer(ctx, &Config{ + Corpus: corpus.NewCorpus(ctx), Coverage: true, EnabledCalls: calls, }, rand.New(rand.NewSource(time.Now().UnixNano())), target) @@ -160,7 +162,7 @@ func (f *testFuzzer) oneMore() bool { defer f.mu.Unlock() f.iter++ if f.iter%100 == 0 { - stat := f.fuzzer.Corpus.Stat() + stat := f.fuzzer.Stat() f.t.Logf("<iter %d>: corpus %d, signal %d, max signal %d, crash types %d", f.iter, stat.Progs, stat.Signal, stat.MaxSignal, len(f.crashes)) } |
