1 /* 2 Copyright 2018 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package coverage 18 19 import ( 20 "io" 21 "reflect" 22 "time" 23 ) 24 25 // This is an implementation of testing.testDeps. It doesn't need to do anything, because 26 // no tests are actually run. It does need a concrete implementation of at least ImportPath, 27 // which is called unconditionally when running tests. 28 // 29 //nolint:unused // U1000 see comment above, we know it's unused normally. 30 type fakeTestDeps struct{} 31 32 // https://go.dev/src/testing/fuzz.go#L88 33 // 34 //nolint:unused // U1000 see comment above, we know it's unused normally. 35 type corpusEntry = struct { 36 Parent string 37 Path string 38 Data []byte 39 Values []any 40 Generation int 41 IsSeed bool 42 } 43 44 //nolint:unused // U1000 see comment above, we know it's unused normally. 45 func (fakeTestDeps) ImportPath() string { 46 return "" 47 } 48 49 //nolint:unused // U1000 see comment above, we know it's unused normally. 50 func (fakeTestDeps) MatchString(pat, str string) (bool, error) { 51 return false, nil 52 } 53 54 //nolint:unused // U1000 see comment above, we know it's unused normally. 55 func (fakeTestDeps) SetPanicOnExit0(bool) {} 56 57 //nolint:unused // U1000 see comment above, we know it's unused normally. 58 func (fakeTestDeps) StartCPUProfile(io.Writer) error { 59 return nil 60 } 61 62 //nolint:unused // U1000 see comment above, we know it's unused normally. 63 func (fakeTestDeps) StopCPUProfile() {} 64 65 //nolint:unused // U1000 see comment above, we know it's unused normally. 66 func (fakeTestDeps) StartTestLog(io.Writer) {} 67 68 //nolint:unused // U1000 see comment above, we know it's unused normally. 69 func (fakeTestDeps) StopTestLog() error { 70 return nil 71 } 72 73 //nolint:unused // U1000 see comment above, we know it's unused normally. 74 func (fakeTestDeps) WriteHeapProfile(io.Writer) error { 75 return nil 76 } 77 78 //nolint:unused // U1000 see comment above, we know it's unused normally. 79 func (fakeTestDeps) WriteProfileTo(string, io.Writer, int) error { 80 return nil 81 } 82 83 //nolint:unused // U1000 see comment above, we know it's unused normally. 84 func (fakeTestDeps) CoordinateFuzzing(time.Duration, int64, time.Duration, int64, int, []corpusEntry, []reflect.Type, string, string) error { 85 return nil 86 } 87 88 //nolint:unused // U1000 see comment above, we know it's unused normally. 89 func (fakeTestDeps) RunFuzzWorker(func(corpusEntry) error) error { 90 return nil 91 } 92 93 //nolint:unused // U1000 see comment above, we know it's unused normally. 94 func (fakeTestDeps) ReadCorpus(string, []reflect.Type) ([]corpusEntry, error) { 95 return nil, nil 96 } 97 98 //nolint:unused // U1000 see comment above, we know it's unused normally. 99 func (fakeTestDeps) CheckCorpus([]any, []reflect.Type) error { 100 return nil 101 } 102 103 //nolint:unused // U1000 see comment above, we know it's unused normally. 104 func (fakeTestDeps) ResetCoverage() {} 105 106 //nolint:unused // U1000 see comment above, we know it's unused normally. 107 func (fakeTestDeps) SnapshotCoverage() {} 108