...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package kiviktest
16
17 import (
18 "io"
19 "os"
20 "reflect"
21 "regexp"
22 "testing"
23 "time"
24 )
25
26 type corpusEntry = struct {
27 Parent string
28 Path string
29 Data []byte
30 Values []interface{}
31 Generation int
32 IsSeed bool
33 }
34
35
36 type testDeps interface {
37 ImportPath() string
38 MatchString(pat, str string) (bool, error)
39 SetPanicOnExit0(bool)
40 StartCPUProfile(io.Writer) error
41 StopCPUProfile()
42 StartTestLog(io.Writer)
43 StopTestLog() error
44 WriteProfileTo(string, io.Writer, int) error
45 CoordinateFuzzing(time.Duration, int64, time.Duration, int64, int, []corpusEntry, []reflect.Type, string, string) error
46 RunFuzzWorker(func(corpusEntry) error) error
47 ReadCorpus(string, []reflect.Type) ([]corpusEntry, error)
48 CheckCorpus([]interface{}, []reflect.Type) error
49 ResetCoverage()
50 SnapshotCoverage()
51 }
52
53 type deps struct{}
54
55 var _ testDeps = &deps{}
56
57 func (*deps) MatchString(pat, str string) (bool, error) { return regexp.MatchString(pat, str) }
58 func (*deps) StartCPUProfile(_ io.Writer) error { return nil }
59 func (*deps) StopCPUProfile() {}
60 func (*deps) WriteHeapProfile(_ io.Writer) error { return nil }
61 func (*deps) WriteProfileTo(_ string, _ io.Writer, _ int) error { return nil }
62 func (*deps) ImportPath() string { return "" }
63 func (*deps) StartTestLog(io.Writer) {}
64 func (*deps) StopTestLog() error { return nil }
65 func (*deps) SetPanicOnExit0(bool) {}
66 func (*deps) CheckCorpus([]interface{}, []reflect.Type) error { return nil }
67 func (*deps) CoordinateFuzzing(time.Duration, int64, time.Duration, int64, int, []corpusEntry, []reflect.Type, string, string) error {
68 return nil
69 }
70 func (*deps) RunFuzzWorker(func(corpusEntry) error) error { return nil }
71 func (*deps) ReadCorpus(string, []reflect.Type) ([]corpusEntry, error) { return nil, nil }
72 func (*deps) ResetCoverage() {}
73 func (*deps) SnapshotCoverage() {}
74 func (*deps) InitRuntimeCoverage() (string, func(string, string) (string, error), func() float64) {
75 return "", nil, nil
76 }
77
78 func mainStart(tests []testing.InternalTest) {
79 m := testing.MainStart(&deps{}, tests, nil, nil, nil)
80 os.Exit(m.Run())
81 }
82
View as plain text