| 1 | // Package check is a rich testing extension for Go's testing package. |
| 2 | // |
| 3 | // For details about the project, see: |
| 4 | // |
| 5 | // http://labix.org/gocheck |
| 6 | // |
| 7 | package checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/ |
| 8 | |
| 9 | import ( |
| 10 | "bytesscip-go gomod github.com/golang/go/src go1.13 bytes/" |
| 11 | "errorsscip-go gomod github.com/golang/go/src go1.13 errors/" |
| 12 | "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 13 | "ioscip-go gomod github.com/golang/go/src go1.13 io/" |
| 14 | "math/randscip-go gomod github.com/golang/go/src go1.13 `math/rand`/" |
| 15 | "osscip-go gomod github.com/golang/go/src go1.13 os/" |
| 16 | "pathscip-go gomod github.com/golang/go/src go1.13 path/" |
| 17 | "path/filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/" |
| 18 | "reflectscip-go gomod github.com/golang/go/src go1.13 reflect/" |
| 19 | "regexpscip-go gomod github.com/golang/go/src go1.13 regexp/" |
| 20 | "runtimescip-go gomod github.com/golang/go/src go1.13 runtime/" |
| 21 | "strconvscip-go gomod github.com/golang/go/src go1.13 strconv/" |
| 22 | "stringsscip-go gomod github.com/golang/go/src go1.13 strings/" |
| 23 | "syncscip-go gomod github.com/golang/go/src go1.13 sync/" |
| 24 | "sync/atomicscip-go gomod github.com/golang/go/src go1.13 `sync/atomic`/" |
| 25 | "timescip-go gomod github.com/golang/go/src go1.13 time/" |
| 26 | ) |
| 27 | |
| 28 | // ----------------------------------------------------------------------- |
| 29 | // Internal type which deals with suite method calling. |
| 30 | |
| 31 | const ( |
| 32 | fixtureKdscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixtureKd. = iota |
| 33 | testKdscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/testKd. |
| 34 | ) |
| 35 | |
| 36 | type funcKindscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcKind# int |
| 37 | |
| 38 | const ( |
| 39 | succeededStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/succeededSt. = iota |
| 40 | failedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/failedSt. |
| 41 | skippedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/skippedSt. |
| 42 | panickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/panickedSt. |
| 43 | fixturePanickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanickedSt. |
| 44 | missedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/missedSt. |
| 45 | timeoutStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timeoutSt. |
| 46 | ) |
| 47 | |
| 48 | type funcStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcStatus# uint32 |
| 49 | |
| 50 | // A method value can't reach its own Method structure. |
| 51 | type methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType# struct { |
| 52 | reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.Valuescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Value. |
| 53 | Infoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Info. reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.Methodscip-go gomod github.com/golang/go/src go1.13 reflect/Method# |
| 54 | } |
| 55 | |
| 56 | func newMethodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/newMethod().(receiver reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.Valuescip-go gomod github.com/golang/go/src go1.13 reflect/Value#, i int) *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType# { |
| 57 | return &methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#{receiver.Methodscip-go gomod github.com/golang/go/src go1.13 reflect/Value#Method().(i), receiver.Typescip-go gomod github.com/golang/go/src go1.13 reflect/Value#Type().().Methodscip-go gomod github.com/golang/go/src go1.13 reflect/Type#Method().(i)} |
| 58 | } |
| 59 | |
| 60 | func (method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#) PCscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#PC().() uintptr { |
| 61 | return method.Infoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Info..Funcscip-go gomod github.com/golang/go/src go1.13 reflect/Method#Func..Pointerscip-go gomod github.com/golang/go/src go1.13 reflect/Value#Pointer().() |
| 62 | } |
| 63 | |
| 64 | func (method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#) suiteNamescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#suiteName().() string { |
| 65 | t := method.Infoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Info..Typescip-go gomod github.com/golang/go/src go1.13 reflect/Method#Type..Inscip-go gomod github.com/golang/go/src go1.13 reflect/Type#In().(0) |
| 66 | if t.Kindscip-go gomod github.com/golang/go/src go1.13 reflect/Type#Kind().() == reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.Ptrscip-go gomod github.com/golang/go/src go1.13 reflect/Ptr. { |
| 67 | t = t.Elemscip-go gomod github.com/golang/go/src go1.13 reflect/Type#Elem().() |
| 68 | } |
| 69 | return t.Namescip-go gomod github.com/golang/go/src go1.13 reflect/Type#Name().() |
| 70 | } |
| 71 | |
| 72 | func (method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#) Stringscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#String().() string { |
| 73 | return method.suiteNamescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#suiteName().() + "." + method.Infoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Info..Namescip-go gomod github.com/golang/go/src go1.13 reflect/Method#Name. |
| 74 | } |
| 75 | |
| 76 | func (method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#) matchesscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#matches().(re *regexpscip-go gomod github.com/golang/go/src go1.13 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.13 regexp/Regexp#) bool { |
| 77 | return (re.MatchStringscip-go gomod github.com/golang/go/src go1.13 regexp/Regexp#MatchString().(method.Infoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Info..Namescip-go gomod github.com/golang/go/src go1.13 reflect/Method#Name.) || |
| 78 | re.MatchStringscip-go gomod github.com/golang/go/src go1.13 regexp/Regexp#MatchString().(method.suiteNamescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#suiteName().()) || |
| 79 | re.MatchStringscip-go gomod github.com/golang/go/src go1.13 regexp/Regexp#MatchString().(method.Stringscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#String().())) |
| 80 | } |
| 81 | |
| 82 | type Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# struct { |
| 83 | methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method. *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType# |
| 84 | kindscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#kind. funcKindscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcKind# |
| 85 | testNamescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#testName. string |
| 86 | _statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#_status. funcStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcStatus# |
| 87 | logbscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logb. *loggerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger# |
| 88 | logwscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logw. ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer# |
| 89 | donescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#done. chan *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# |
| 90 | parallelscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#parallel. chan *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# |
| 91 | reasonscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#reason. string |
| 92 | mustFailscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#mustFail. bool |
| 93 | tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#tempDir. *tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir# |
| 94 | benchMemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#benchMem. bool |
| 95 | startTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#startTime. timescip-go gomod github.com/golang/go/src go1.13 time/.Timescip-go gomod github.com/golang/go/src go1.13 time/Time# |
| 96 | timerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#timer. |
| 97 | } |
| 98 | |
| 99 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() funcStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcStatus# { |
| 100 | return funcStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcStatus#(atomicscip-go gomod github.com/golang/go/src go1.13 `sync/atomic`/.LoadUint32scip-go gomod github.com/golang/go/src go1.13 `sync/atomic`/LoadUint32().((*uint32)(&c._statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#_status.))) |
| 101 | } |
| 102 | |
| 103 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) setStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#setStatus().(s funcStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcStatus#) { |
| 104 | atomicscip-go gomod github.com/golang/go/src go1.13 `sync/atomic`/.StoreUint32scip-go gomod github.com/golang/go/src go1.13 `sync/atomic`/StoreUint32().((*uint32)(&c._statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#_status.), uint32(s)) |
| 105 | } |
| 106 | |
| 107 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) stopNowscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#stopNow().() { |
| 108 | runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.Goexitscip-go gomod github.com/golang/go/src go1.13 runtime/Goexit().() |
| 109 | } |
| 110 | |
| 111 | // logger is a concurrency safe byte.Buffer |
| 112 | type loggerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger# struct { |
| 113 | syncscip-go gomod github.com/golang/go/src go1.13 sync/.Mutexscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#Mutex. |
| 114 | writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#writer. bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer# |
| 115 | } |
| 116 | |
| 117 | func (l *loggerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#) Writescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#Write().(buf []byte) (int, error) { |
| 118 | l.Lockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Lock().() |
| 119 | defer l.Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Unlock().() |
| 120 | return l.writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#writer..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(buf) |
| 121 | } |
| 122 | |
| 123 | func (l *loggerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#) WriteToscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#WriteTo().(w ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer#) (int64, error) { |
| 124 | l.Lockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Lock().() |
| 125 | defer l.Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Unlock().() |
| 126 | return l.writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#writer..WriteToscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#WriteTo().(w) |
| 127 | } |
| 128 | |
| 129 | func (l *loggerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#) Stringscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#String().() string { |
| 130 | l.Lockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Lock().() |
| 131 | defer l.Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Unlock().() |
| 132 | return l.writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#writer..Stringscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#String().() |
| 133 | } |
| 134 | |
| 135 | // ----------------------------------------------------------------------- |
| 136 | // Handling of temporary files and directories. |
| 137 | |
| 138 | type tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir# struct { |
| 139 | syncscip-go gomod github.com/golang/go/src go1.13 sync/.Mutexscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#Mutex. |
| 140 | pathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#path. string |
| 141 | counterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#counter. int |
| 142 | } |
| 143 | |
| 144 | func (td *tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#) newPathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#newPath().() string { |
| 145 | td.Lockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Lock().() |
| 146 | defer td.Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Unlock().() |
| 147 | if td.pathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#path. == "" { |
| 148 | var err error |
| 149 | for i := 0; i != 100; i++ { |
| 150 | path := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%s%ccheck-%d", osscip-go gomod github.com/golang/go/src go1.13 os/.TempDirscip-go gomod github.com/golang/go/src go1.13 os/TempDir().(), osscip-go gomod github.com/golang/go/src go1.13 os/.PathSeparatorscip-go gomod github.com/golang/go/src go1.13 os/PathSeparator., randscip-go gomod github.com/golang/go/src go1.13 `math/rand`/.Intscip-go gomod github.com/golang/go/src go1.13 `math/rand`/Int().()) |
| 151 | if err = osscip-go gomod github.com/golang/go/src go1.13 os/.Mkdirscip-go gomod github.com/golang/go/src go1.13 os/Mkdir().(path, 0700); err == nil { |
| 152 | td.pathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#path. = path |
| 153 | break |
| 154 | } |
| 155 | } |
| 156 | if td.pathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#path. == "" { |
| 157 | panic("Couldn't create temporary directory: " + err.Error()) |
| 158 | } |
| 159 | } |
| 160 | result := filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/Join().(td.pathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#path., strconvscip-go gomod github.com/golang/go/src go1.13 strconv/.Itoascip-go gomod github.com/golang/go/src go1.13 strconv/Itoa().(td.counterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#counter.)) |
| 161 | td.counterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#counter. += 1 |
| 162 | return result |
| 163 | } |
| 164 | |
| 165 | func (td *tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#) removeAllscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#removeAll().() { |
| 166 | td.Lockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Lock().() |
| 167 | defer td.Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Unlock().() |
| 168 | if td.pathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#path. != "" { |
| 169 | err := osscip-go gomod github.com/golang/go/src go1.13 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.13 os/RemoveAll().(td.pathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#path.) |
| 170 | if err != nil { |
| 171 | fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Fprintf().(osscip-go gomod github.com/golang/go/src go1.13 os/.Stderrscip-go gomod github.com/golang/go/src go1.13 os/Stderr., "WARNING: Error cleaning up temporaries: "+err.Error()) |
| 172 | } |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | // Create a new temporary directory which is automatically removed after |
| 177 | // the suite finishes running. |
| 178 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) MkDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#MkDir().() string { |
| 179 | path := c.tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#tempDir..newPathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#newPath().() |
| 180 | if err := osscip-go gomod github.com/golang/go/src go1.13 os/.Mkdirscip-go gomod github.com/golang/go/src go1.13 os/Mkdir().(path, 0700); err != nil { |
| 181 | panic(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("Couldn't create temporary directory %s: %s", path, err.Error())) |
| 182 | } |
| 183 | return path |
| 184 | } |
| 185 | |
| 186 | // ----------------------------------------------------------------------- |
| 187 | // Low-level logging functions. |
| 188 | |
| 189 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#log().(args ...interface{}) { |
| 190 | c.writeLogscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#writeLog().([]byte(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintscip-go gomod github.com/golang/go/src go1.13 fmt/Sprint().(args...) + "\n")) |
| 191 | } |
| 192 | |
| 193 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().(format string, args ...interface{}) { |
| 194 | c.writeLogscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#writeLog().([]byte(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().(format+"\n", args...))) |
| 195 | } |
| 196 | |
| 197 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logNewLinescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logNewLine().() { |
| 198 | c.writeLogscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#writeLog().([]byte{'\n'}) |
| 199 | } |
| 200 | |
| 201 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) writeLogscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#writeLog().(buf []byte) { |
| 202 | c.logbscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logb..Writescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#Write().(buf) |
| 203 | if c.logwscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logw. != nil { |
| 204 | c.logwscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logw..Writescip-go gomod github.com/golang/go/src go1.13 io/Writer#Write().(buf) |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | func hasStringOrErrorscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/hasStringOrError().(x interface{}) (ok bool) { |
| 209 | _, ok = x.(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Stringerscip-go gomod github.com/golang/go/src go1.13 fmt/Stringer#) |
| 210 | if ok { |
| 211 | return |
| 212 | } |
| 213 | _, ok = x.(error) |
| 214 | return |
| 215 | } |
| 216 | |
| 217 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logValuescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logValue().(label string, value interface{}) { |
| 218 | if label == "" { |
| 219 | if hasStringOrErrorscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/hasStringOrError().(value) { |
| 220 | c.logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().("... %#v (%q)", value, value) |
| 221 | } else { |
| 222 | c.logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().("... %#v", value) |
| 223 | } |
| 224 | } else if value == nil { |
| 225 | c.logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().("... %s = nil", label) |
| 226 | } else { |
| 227 | if hasStringOrErrorscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/hasStringOrError().(value) { |
| 228 | fv := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%#v", value) |
| 229 | qv := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%q", value) |
| 230 | if fv != qv { |
| 231 | c.logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().("... %s %s = %s (%s)", label, reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.13 reflect/TypeOf().(value), fv, qv) |
| 232 | return |
| 233 | } |
| 234 | } |
| 235 | if s, ok := value.(string); ok && isMultiLinescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/isMultiLine().(s) { |
| 236 | c.logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().(`... %s %s = "" +`, label, reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.13 reflect/TypeOf().(value)) |
| 237 | c.logMultiLinescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logMultiLine().(s) |
| 238 | } else { |
| 239 | c.logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().("... %s %s = %#v", label, reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.13 reflect/TypeOf().(value), value) |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logMultiLinescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logMultiLine().(s string) { |
| 245 | b := make([]byte, 0, len(s)*2) |
| 246 | i := 0 |
| 247 | n := len(s) |
| 248 | for i < n { |
| 249 | j := i + 1 |
| 250 | for j < n && s[j-1] != '\n' { |
| 251 | j++ |
| 252 | } |
| 253 | b = append(b, "... "...) |
| 254 | b = strconvscip-go gomod github.com/golang/go/src go1.13 strconv/.AppendQuotescip-go gomod github.com/golang/go/src go1.13 strconv/AppendQuote().(b, s[i:j]) |
| 255 | if j < n { |
| 256 | b = append(b, " +"...) |
| 257 | } |
| 258 | b = append(b, '\n') |
| 259 | i = j |
| 260 | } |
| 261 | c.writeLogscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#writeLog().(b) |
| 262 | } |
| 263 | |
| 264 | func isMultiLinescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/isMultiLine().(s string) bool { |
| 265 | for i := 0; i+1 < len(s); i++ { |
| 266 | if s[i] == '\n' { |
| 267 | return true |
| 268 | } |
| 269 | } |
| 270 | return false |
| 271 | } |
| 272 | |
| 273 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logStringscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logString().(issue string) { |
| 274 | c.logscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#log().("... ", issue) |
| 275 | } |
| 276 | |
| 277 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logCallerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logCaller().(skip int) { |
| 278 | // This is a bit heavier than it ought to be. |
| 279 | skip += 1 // Our own frame. |
| 280 | pc, callerFile, callerLine, ok := runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.Callerscip-go gomod github.com/golang/go/src go1.13 runtime/Caller().(skip) |
| 281 | if !ok { |
| 282 | return |
| 283 | } |
| 284 | var testFile string |
| 285 | var testLine int |
| 286 | testFunc := runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.FuncForPCscip-go gomod github.com/golang/go/src go1.13 runtime/FuncForPC().(c.methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method..PCscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#PC().()) |
| 287 | if runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.FuncForPCscip-go gomod github.com/golang/go/src go1.13 runtime/FuncForPC().(pc) != testFunc { |
| 288 | for { |
| 289 | skip += 1 |
| 290 | if pc, file, line, ok := runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.Callerscip-go gomod github.com/golang/go/src go1.13 runtime/Caller().(skip); ok { |
| 291 | // Note that the test line may be different on |
| 292 | // distinct calls for the same test. Showing |
| 293 | // the "internal" line is helpful when debugging. |
| 294 | if runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.FuncForPCscip-go gomod github.com/golang/go/src go1.13 runtime/FuncForPC().(pc) == testFunc { |
| 295 | testFile, testLine = file, line |
| 296 | break |
| 297 | } |
| 298 | } else { |
| 299 | break |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | if testFile != "" && (testFile != callerFile || testLine != callerLine) { |
| 304 | c.logCodescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logCode().(testFile, testLine) |
| 305 | } |
| 306 | c.logCodescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logCode().(callerFile, callerLine) |
| 307 | } |
| 308 | |
| 309 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logCodescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logCode().(path string, line int) { |
| 310 | c.logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().("%s:%d:", nicePathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/nicePath().(path), line) |
| 311 | code, err := printLinescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/printLine().(path, line) |
| 312 | if code == "" { |
| 313 | code = "..." // XXX Open the file and take the raw line. |
| 314 | if err != nil { |
| 315 | code += err.Error() |
| 316 | } |
| 317 | } |
| 318 | c.logscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#log().(indentscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/indent().(code, " ")) |
| 319 | } |
| 320 | |
| 321 | var valueGoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/valueGo. = filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/Join().("reflect", "value.go") |
| 322 | var asmGoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/asmGo. = filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/Join().("runtime", "asm_") |
| 323 | |
| 324 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logPanic().(skip int, value interface{}) { |
| 325 | skip++ // Our own frame. |
| 326 | initialSkip := skip |
| 327 | for ; ; skip++ { |
| 328 | if pc, file, line, ok := runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.Callerscip-go gomod github.com/golang/go/src go1.13 runtime/Caller().(skip); ok { |
| 329 | if skip == initialSkip { |
| 330 | c.logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().("... Panic: %s (PC=0x%X)\n", value, pc) |
| 331 | } |
| 332 | name := niceFuncNamescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/niceFuncName().(pc) |
| 333 | path := nicePathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/nicePath().(file) |
| 334 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Containsscip-go gomod github.com/golang/go/src go1.13 strings/Contains().(path, "/gopkg.in/check.v") { |
| 335 | continue |
| 336 | } |
| 337 | if name == "Value.call" && stringsscip-go gomod github.com/golang/go/src go1.13 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.13 strings/HasSuffix().(path, valueGoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/valueGo.) { |
| 338 | continue |
| 339 | } |
| 340 | if (name == "call16" || name == "call32") && stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Containsscip-go gomod github.com/golang/go/src go1.13 strings/Contains().(path, asmGoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/asmGo.) { |
| 341 | continue |
| 342 | } |
| 343 | c.logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().("%s:%d\n in %s", nicePathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/nicePath().(file), line, name) |
| 344 | } else { |
| 345 | break |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logSoftPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logSoftPanic().(issue string) { |
| 351 | c.logscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#log().("... Panic: ", issue) |
| 352 | } |
| 353 | |
| 354 | func (c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) logArgPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logArgPanic().(method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#, expectedType string) { |
| 355 | c.logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logf().("... Panic: %s argument should be %s", |
| 356 | niceFuncNamescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/niceFuncName().(method.PCscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#PC().()), expectedType) |
| 357 | } |
| 358 | |
| 359 | // ----------------------------------------------------------------------- |
| 360 | // Some simple formatting helpers. |
| 361 | |
| 362 | var initWDscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/initWD., initWDErrscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/initWDErr. = osscip-go gomod github.com/golang/go/src go1.13 os/.Getwdscip-go gomod github.com/golang/go/src go1.13 os/Getwd().() |
| 363 | |
| 364 | func initscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/init().() { |
| 365 | if initWDErrscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/initWDErr. == nil { |
| 366 | initWDscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/initWD. = stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Replacescip-go gomod github.com/golang/go/src go1.13 strings/Replace().(initWDscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/initWD., "\\", "/", -1) + "/" |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | func nicePathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/nicePath().(path string) string { |
| 371 | if initWDErrscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/initWDErr. == nil { |
| 372 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.13 strings/HasPrefix().(path, initWDscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/initWD.) { |
| 373 | return path[len(initWDscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/initWD.):] |
| 374 | } |
| 375 | } |
| 376 | return path |
| 377 | } |
| 378 | |
| 379 | func niceFuncPathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/niceFuncPath().(pc uintptr) string { |
| 380 | function := runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.FuncForPCscip-go gomod github.com/golang/go/src go1.13 runtime/FuncForPC().(pc) |
| 381 | if function != nil { |
| 382 | filename, line := function.FileLinescip-go gomod github.com/golang/go/src go1.13 runtime/Func#FileLine().(pc) |
| 383 | return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%s:%d", nicePathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/nicePath().(filename), line) |
| 384 | } |
| 385 | return "<unknown path>" |
| 386 | } |
| 387 | |
| 388 | func niceFuncNamescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/niceFuncName().(pc uintptr) string { |
| 389 | function := runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.FuncForPCscip-go gomod github.com/golang/go/src go1.13 runtime/FuncForPC().(pc) |
| 390 | if function != nil { |
| 391 | name := pathscip-go gomod github.com/golang/go/src go1.13 path/.Basescip-go gomod github.com/golang/go/src go1.13 path/Base().(function.Namescip-go gomod github.com/golang/go/src go1.13 runtime/Func#Name().()) |
| 392 | if i := stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Indexscip-go gomod github.com/golang/go/src go1.13 strings/Index().(name, "."); i > 0 { |
| 393 | name = name[i+1:] |
| 394 | } |
| 395 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.13 strings/HasPrefix().(name, "(*") { |
| 396 | if i := stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Indexscip-go gomod github.com/golang/go/src go1.13 strings/Index().(name, ")"); i > 0 { |
| 397 | name = name[2:i] + name[i+1:] |
| 398 | } |
| 399 | } |
| 400 | if i := stringsscip-go gomod github.com/golang/go/src go1.13 strings/.LastIndexscip-go gomod github.com/golang/go/src go1.13 strings/LastIndex().(name, ".*"); i != -1 { |
| 401 | name = name[:i] + "." + name[i+2:] |
| 402 | } |
| 403 | if i := stringsscip-go gomod github.com/golang/go/src go1.13 strings/.LastIndexscip-go gomod github.com/golang/go/src go1.13 strings/LastIndex().(name, "·"); i != -1 { |
| 404 | name = name[:i] + "." + name[i+2:] |
| 405 | } |
| 406 | return name |
| 407 | } |
| 408 | return "<unknown function>" |
| 409 | } |
| 410 | |
| 411 | // ----------------------------------------------------------------------- |
| 412 | // Result tracker to aggregate call results. |
| 413 | |
| 414 | type Resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result# struct { |
| 415 | Succeededscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Succeeded. int |
| 416 | Failedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Failed. int |
| 417 | Skippedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Skipped. int |
| 418 | Panickedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Panicked. int |
| 419 | Timeoutedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Timeouted. int |
| 420 | FixturePanickedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#FixturePanicked. int |
| 421 | ExpectedFailuresscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#ExpectedFailures. int |
| 422 | Missedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Missed. int // Not even tried to run, related to a panic in the fixture. |
| 423 | RunErrorscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#RunError. error // Houston, we've got a problem. |
| 424 | WorkDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#WorkDir. string // If KeepWorkDir is true |
| 425 | } |
| 426 | |
| 427 | type resultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker# struct { |
| 428 | resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result. Resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result# |
| 429 | _lastWasProblemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_lastWasProblem. bool |
| 430 | _waitingscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_waiting. int |
| 431 | _missedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_missed. int |
| 432 | _expectChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_expectChan. chan *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# |
| 433 | _doneChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_doneChan. chan *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# |
| 434 | _stopChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_stopChan. chan bool |
| 435 | } |
| 436 | |
| 437 | func newResultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/newResultTracker().() *resultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker# { |
| 438 | return &resultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#{_expectChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_expectChan.: make(chan *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#), // Synchronous |
| 439 | _doneChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_doneChan.: make(chan *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#, 32), // Asynchronous |
| 440 | _stopChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_stopChan.: make(chan bool)} // Synchronous |
| 441 | } |
| 442 | |
| 443 | func (tracker *resultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#) startscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#start().() { |
| 444 | go tracker._loopRoutinescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_loopRoutine().() |
| 445 | } |
| 446 | |
| 447 | func (tracker *resultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#) waitAndStopscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#waitAndStop().() { |
| 448 | <-tracker._stopChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_stopChan. |
| 449 | } |
| 450 | |
| 451 | func (tracker *resultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#) expectCallscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#expectCall().(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 452 | tracker._expectChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_expectChan. <- c |
| 453 | } |
| 454 | |
| 455 | func (tracker *resultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#) callDonescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#callDone().(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 456 | tracker._doneChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_doneChan. <- c |
| 457 | } |
| 458 | |
| 459 | func (tracker *resultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#) _loopRoutinescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_loopRoutine().() { |
| 460 | for { |
| 461 | var c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# |
| 462 | if tracker._waitingscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_waiting. > 0 { |
| 463 | // Calls still running. Can't stop. |
| 464 | select { |
| 465 | // XXX Reindent this (not now to make diff clear) |
| 466 | case c = <-tracker._expectChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_expectChan.: |
| 467 | tracker._waitingscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_waiting. += 1 |
| 468 | case c = <-tracker._doneChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_doneChan.: |
| 469 | tracker._waitingscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_waiting. -= 1 |
| 470 | switch c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() { |
| 471 | case succeededStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/succeededSt.: |
| 472 | if c.kindscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#kind. == testKdscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/testKd. { |
| 473 | if c.mustFailscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#mustFail. { |
| 474 | tracker.resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..ExpectedFailuresscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#ExpectedFailures.++ |
| 475 | } else { |
| 476 | tracker.resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..Succeededscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Succeeded.++ |
| 477 | } |
| 478 | } |
| 479 | case failedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/failedSt.: |
| 480 | tracker.resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..Failedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Failed.++ |
| 481 | case timeoutStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timeoutSt.: |
| 482 | tracker.resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..Timeoutedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Timeouted.++ |
| 483 | case panickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/panickedSt.: |
| 484 | if c.kindscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#kind. == fixtureKdscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixtureKd. { |
| 485 | tracker.resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..FixturePanickedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#FixturePanicked.++ |
| 486 | } else { |
| 487 | tracker.resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..Panickedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Panicked.++ |
| 488 | } |
| 489 | case fixturePanickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanickedSt.: |
| 490 | // Track it as missed, since the panic |
| 491 | // was on the fixture, not on the test. |
| 492 | tracker.resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..Missedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Missed.++ |
| 493 | case missedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/missedSt.: |
| 494 | tracker.resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..Missedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Missed.++ |
| 495 | case skippedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/skippedSt.: |
| 496 | if c.kindscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#kind. == testKdscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/testKd. { |
| 497 | tracker.resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..Skippedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#Skipped.++ |
| 498 | } |
| 499 | } |
| 500 | } |
| 501 | } else { |
| 502 | // No calls. Can stop, but no done calls here. |
| 503 | select { |
| 504 | case tracker._stopChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_stopChan. <- true: |
| 505 | return |
| 506 | case c = <-tracker._expectChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_expectChan.: |
| 507 | tracker._waitingscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_waiting. += 1 |
| 508 | case c = <-tracker._doneChanscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#_doneChan.: |
| 509 | panic("Tracker got an unexpected done call.") |
| 510 | } |
| 511 | } |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | // ----------------------------------------------------------------------- |
| 516 | // The underlying suite runner. |
| 517 | |
| 518 | type suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner# struct { |
| 519 | suitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#suite. interface{} |
| 520 | setUpSuitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#setUpSuite., tearDownSuitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tearDownSuite. *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType# |
| 521 | setUpTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#setUpTest., tearDownTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tearDownTest. *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType# |
| 522 | testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests. []*methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType# |
| 523 | trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker. *resultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker# |
| 524 | tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tempDir. *tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir# |
| 525 | keepDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#keepDir. bool |
| 526 | outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output. *outputWriterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter# |
| 527 | reportedProblemLastscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#reportedProblemLast. bool |
| 528 | benchTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#benchTime. timescip-go gomod github.com/golang/go/src go1.13 time/.Durationscip-go gomod github.com/golang/go/src go1.13 time/Duration# |
| 529 | benchMemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#benchMem. bool |
| 530 | methodTimeoutscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#methodTimeout. timescip-go gomod github.com/golang/go/src go1.13 time/.Durationscip-go gomod github.com/golang/go/src go1.13 time/Duration# |
| 531 | } |
| 532 | |
| 533 | type RunConfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf# struct { |
| 534 | Outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Output. ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer# |
| 535 | Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Stream. bool |
| 536 | Verbosescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Verbose. bool |
| 537 | Filterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Filter. string |
| 538 | MethodTimeoutscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#MethodTimeout. timescip-go gomod github.com/golang/go/src go1.13 time/.Durationscip-go gomod github.com/golang/go/src go1.13 time/Duration# |
| 539 | Benchmarkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Benchmark. bool |
| 540 | BenchmarkTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#BenchmarkTime. timescip-go gomod github.com/golang/go/src go1.13 time/.Durationscip-go gomod github.com/golang/go/src go1.13 time/Duration# // Defaults to 1 second |
| 541 | BenchmarkMemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#BenchmarkMem. bool |
| 542 | KeepWorkDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#KeepWorkDir. bool |
| 543 | Excludescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Exclude. string |
| 544 | } |
| 545 | |
| 546 | // Create a new suiteRunner able to run all methods in the given suite. |
| 547 | func newSuiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/newSuiteRunner().(suite interface{}, runConf *RunConfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#) *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner# { |
| 548 | var conf RunConfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf# |
| 549 | if runConf != nil { |
| 550 | conf = *runConf |
| 551 | } |
| 552 | if conf.Outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Output. == nil { |
| 553 | conf.Outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Output. = osscip-go gomod github.com/golang/go/src go1.13 os/.Stdoutscip-go gomod github.com/golang/go/src go1.13 os/Stdout. |
| 554 | } |
| 555 | if conf.Benchmarkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Benchmark. { |
| 556 | conf.Verbosescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Verbose. = true |
| 557 | } |
| 558 | |
| 559 | suiteType := reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.13 reflect/TypeOf().(suite) |
| 560 | suiteNumMethods := suiteType.NumMethodscip-go gomod github.com/golang/go/src go1.13 reflect/Type#NumMethod().() |
| 561 | suiteValue := reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.13 reflect/ValueOf().(suite) |
| 562 | |
| 563 | runner := &suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#{ |
| 564 | suitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#suite.: suite, |
| 565 | outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output.: newOutputWriterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/newOutputWriter().(conf.Outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Output., conf.Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Stream., conf.Verbosescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Verbose.), |
| 566 | trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker.: newResultTrackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/newResultTracker().(), |
| 567 | benchTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#benchTime.: conf.BenchmarkTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#BenchmarkTime., |
| 568 | benchMemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#benchMem.: conf.BenchmarkMemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#BenchmarkMem., |
| 569 | tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tempDir.: &tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#{}, |
| 570 | keepDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#keepDir.: conf.KeepWorkDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#KeepWorkDir., |
| 571 | testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests.: make([]*methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#, 0, suiteNumMethods), |
| 572 | methodTimeoutscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#methodTimeout.: conf.MethodTimeoutscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#MethodTimeout., |
| 573 | } |
| 574 | if runner.benchTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#benchTime. == 0 { |
| 575 | runner.benchTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#benchTime. = 1 * timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second. |
| 576 | } |
| 577 | |
| 578 | var filterRegexp *regexpscip-go gomod github.com/golang/go/src go1.13 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.13 regexp/Regexp# |
| 579 | if conf.Filterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Filter. != "" { |
| 580 | if regexp, err := regexpscip-go gomod github.com/golang/go/src go1.13 regexp/.Compilescip-go gomod github.com/golang/go/src go1.13 regexp/Compile().(conf.Filterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Filter.); err != nil { |
| 581 | msg := "Bad filter expression: " + err.Error() |
| 582 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..RunErrorscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#RunError. = errorsscip-go gomod github.com/golang/go/src go1.13 errors/.Newscip-go gomod github.com/golang/go/src go1.13 errors/New().(msg) |
| 583 | return runner |
| 584 | } else { |
| 585 | filterRegexp = regexp |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | var excludeRegexp *regexpscip-go gomod github.com/golang/go/src go1.13 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.13 regexp/Regexp# |
| 590 | if conf.Excludescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Exclude. != "" { |
| 591 | if regexp, err := regexpscip-go gomod github.com/golang/go/src go1.13 regexp/.Compilescip-go gomod github.com/golang/go/src go1.13 regexp/Compile().(conf.Excludescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Exclude.); err != nil { |
| 592 | msg := "Bad exclude expression: " + err.Error() |
| 593 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..RunErrorscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#RunError. = errorsscip-go gomod github.com/golang/go/src go1.13 errors/.Newscip-go gomod github.com/golang/go/src go1.13 errors/New().(msg) |
| 594 | return runner |
| 595 | } else { |
| 596 | excludeRegexp = regexp |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | for i := 0; i != suiteNumMethods; i++ { |
| 601 | method := newMethodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/newMethod().(suiteValue, i) |
| 602 | switch method.Infoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Info..Namescip-go gomod github.com/golang/go/src go1.13 reflect/Method#Name. { |
| 603 | case "SetUpSuite": |
| 604 | runner.setUpSuitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#setUpSuite. = method |
| 605 | case "TearDownSuite": |
| 606 | runner.tearDownSuitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tearDownSuite. = method |
| 607 | case "SetUpTest": |
| 608 | runner.setUpTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#setUpTest. = method |
| 609 | case "TearDownTest": |
| 610 | runner.tearDownTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tearDownTest. = method |
| 611 | default: |
| 612 | prefix := "Test" |
| 613 | if conf.Benchmarkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Benchmark. { |
| 614 | prefix = "Benchmark" |
| 615 | } |
| 616 | if !stringsscip-go gomod github.com/golang/go/src go1.13 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.13 strings/HasPrefix().(method.Infoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Info..Namescip-go gomod github.com/golang/go/src go1.13 reflect/Method#Name., prefix) { |
| 617 | continue |
| 618 | } |
| 619 | if filterRegexp == nil || method.matchesscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#matches().(filterRegexp) { |
| 620 | if excludeRegexp == nil || !method.matchesscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#matches().(excludeRegexp) { |
| 621 | runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests. = append(runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests., method) |
| 622 | } |
| 623 | } |
| 624 | } |
| 625 | } |
| 626 | return runner |
| 627 | } |
| 628 | |
| 629 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) asyncRunscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#asyncRun().(wg *syncscip-go gomod github.com/golang/go/src go1.13 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#, notifyRunningSuitesCh chan struct{}) { |
| 630 | if runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..RunErrorscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#RunError. != nil || len(runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests.) <= 0 { |
| 631 | return |
| 632 | } |
| 633 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..startscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#start().() |
| 634 | if !runner.checkFixtureArgsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#checkFixtureArgs().() { |
| 635 | runner.skipTestsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#skipTests().(missedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/missedSt., runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests.) |
| 636 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..waitAndStopscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#waitAndStop().() |
| 637 | if runner.keepDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#keepDir. { |
| 638 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..WorkDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#WorkDir. = runner.tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tempDir..pathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#path. |
| 639 | } else { |
| 640 | runner.tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tempDir..removeAllscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#removeAll().() |
| 641 | } |
| 642 | return |
| 643 | } |
| 644 | |
| 645 | wg.Addscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Add().(1) |
| 646 | go func() { |
| 647 | c := runner.runFixturescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFixture().(runner.setUpSuitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#setUpSuite., "", nil) |
| 648 | defer wg.Donescip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Done().() |
| 649 | <-notifyRunningSuitesCh |
| 650 | runner.doRunscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#doRun().(c) |
| 651 | |
| 652 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..waitAndStopscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#waitAndStop().() |
| 653 | if runner.keepDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#keepDir. { |
| 654 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..WorkDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#WorkDir. = runner.tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tempDir..pathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#path. |
| 655 | } else { |
| 656 | runner.tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tempDir..removeAllscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#removeAll().() |
| 657 | } |
| 658 | }() |
| 659 | } |
| 660 | |
| 661 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) doRunscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#doRun().(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 662 | if c == nil || c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() == succeededStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/succeededSt. { |
| 663 | var delayedC []*Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# |
| 664 | |
| 665 | for i := 0; i != len(runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests.); i++ { |
| 666 | c := runner.forkTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#forkTest().(runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests.[i]) |
| 667 | select { |
| 668 | case <-c.donescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#done.: |
| 669 | case <-c.parallelscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#parallel.: |
| 670 | delayedC = append(delayedC, c) |
| 671 | } |
| 672 | if c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() == fixturePanickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanickedSt. { |
| 673 | runner.skipTestsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#skipTests().(missedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/missedSt., runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests.[i+1:]) |
| 674 | break |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | // Wait those parallel tests finish. |
| 679 | for _, delayed := range delayedC { |
| 680 | <-delayed.donescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#done. |
| 681 | } |
| 682 | } else if c != nil && c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() == skippedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/skippedSt. { |
| 683 | runner.skipTestsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#skipTests().(skippedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/skippedSt., runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests.) |
| 684 | } else { |
| 685 | runner.skipTestsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#skipTests().(missedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/missedSt., runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests.) |
| 686 | } |
| 687 | runner.runFixturescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFixture().(runner.tearDownSuitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tearDownSuite., "", nil) |
| 688 | } |
| 689 | |
| 690 | // Run all methods in the given suite. |
| 691 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) runscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#run().() *Resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result# { |
| 692 | if runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..RunErrorscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#RunError. == nil && len(runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests.) > 0 { |
| 693 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..startscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#start().() |
| 694 | if runner.checkFixtureArgsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#checkFixtureArgs().() { |
| 695 | c := runner.runFixturescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFixture().(runner.setUpSuitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#setUpSuite., "", nil) |
| 696 | runner.doRunscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#doRun().(c) |
| 697 | } else { |
| 698 | runner.skipTestsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#skipTests().(missedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/missedSt., runner.testsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tests.) |
| 699 | } |
| 700 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..waitAndStopscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#waitAndStop().() |
| 701 | if runner.keepDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#keepDir. { |
| 702 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result..WorkDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Result#WorkDir. = runner.tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tempDir..pathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#path. |
| 703 | } else { |
| 704 | runner.tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tempDir..removeAllscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/tempDir#removeAll().() |
| 705 | } |
| 706 | } |
| 707 | return &runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..resultscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#result. |
| 708 | } |
| 709 | |
| 710 | // Create a call object with the given suite method, and fork a |
| 711 | // goroutine with the provided dispatcher for running it. |
| 712 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) forkCallscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#forkCall().(method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#, kind funcKindscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcKind#, testName string, logb *loggerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#, dispatcher func(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#)) *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# { |
| 713 | var logw ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer# |
| 714 | if runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output..Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Stream. { |
| 715 | logw = runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output. |
| 716 | } |
| 717 | if logb == nil { |
| 718 | logb = new(loggerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#) |
| 719 | } |
| 720 | c := &Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#{ |
| 721 | methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method.: method, |
| 722 | kindscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#kind.: kind, |
| 723 | testNamescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#testName.: testName, |
| 724 | logbscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logb.: logb, |
| 725 | logwscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logw.: logw, |
| 726 | tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#tempDir.: runner.tempDirscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tempDir., |
| 727 | donescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#done.: make(chan *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#, 1), |
| 728 | parallelscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#parallel.: make(chan *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#, 1), |
| 729 | timerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#timer.: timerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timer#{benchTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timer#benchTime.: runner.benchTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#benchTime.}, |
| 730 | startTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#startTime.: timescip-go gomod github.com/golang/go/src go1.13 time/.Nowscip-go gomod github.com/golang/go/src go1.13 time/Now().(), |
| 731 | benchMemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#benchMem.: runner.benchMemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#benchMem., |
| 732 | } |
| 733 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..expectCallscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#expectCall().(c) |
| 734 | go (func() { |
| 735 | runner.reportCallStartedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#reportCallStarted().(c) |
| 736 | defer runner.callDonescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#callDone().(c) |
| 737 | startTime := timescip-go gomod github.com/golang/go/src go1.13 time/.Nowscip-go gomod github.com/golang/go/src go1.13 time/Now().() |
| 738 | |
| 739 | dispatcher(c) |
| 740 | |
| 741 | // Don't allow a single test to run too long! |
| 742 | if c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() == succeededStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/succeededSt. && runner.methodTimeoutscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#methodTimeout. > 0 && timescip-go gomod github.com/golang/go/src go1.13 time/.Sincescip-go gomod github.com/golang/go/src go1.13 time/Since().(startTime) > runner.methodTimeoutscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#methodTimeout. { |
| 743 | c.setStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#setStatus().(timeoutStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timeoutSt.) |
| 744 | } |
| 745 | })() |
| 746 | return c |
| 747 | } |
| 748 | |
| 749 | // Same as forkCall(), but wait for call to finish before returning. |
| 750 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) runFuncscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFunc().(method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#, kind funcKindscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcKind#, testName string, logb *loggerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#, dispatcher func(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#)) *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# { |
| 751 | c := runner.forkCallscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#forkCall().(method, kind, testName, logb, dispatcher) |
| 752 | <-c.donescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#done. |
| 753 | return c |
| 754 | } |
| 755 | |
| 756 | // Handle a finished call. If there were any panics, update the call status |
| 757 | // accordingly. Then, mark the call as done and report to the tracker. |
| 758 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) callDonescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#callDone().(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 759 | value := recover() |
| 760 | if value != nil { |
| 761 | switch v := value.(type) { |
| 762 | case *fixturePanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanic#: |
| 763 | if v.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanic#status. == skippedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/skippedSt. { |
| 764 | c.setStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#setStatus().(skippedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/skippedSt.) |
| 765 | } else { |
| 766 | c.logSoftPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logSoftPanic().("Fixture has panicked (see related PANIC)") |
| 767 | c.setStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#setStatus().(fixturePanickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanickedSt.) |
| 768 | } |
| 769 | default: |
| 770 | c.logPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logPanic().(1, value) |
| 771 | c.setStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#setStatus().(panickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/panickedSt.) |
| 772 | } |
| 773 | } |
| 774 | if c.mustFailscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#mustFail. { |
| 775 | switch c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() { |
| 776 | case failedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/failedSt.: |
| 777 | c.setStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#setStatus().(succeededStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/succeededSt.) |
| 778 | case succeededStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/succeededSt.: |
| 779 | c.setStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#setStatus().(failedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/failedSt.) |
| 780 | c.logStringscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logString().("Error: Test succeeded, but was expected to fail") |
| 781 | c.logStringscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logString().("Reason: " + c.reasonscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#reason.) |
| 782 | } |
| 783 | } |
| 784 | |
| 785 | runner.reportCallDonescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#reportCallDone().(c) |
| 786 | c.donescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#done. <- c |
| 787 | } |
| 788 | |
| 789 | // Runs a fixture call synchronously. The fixture will still be run in a |
| 790 | // goroutine like all suite methods, but this method will not return |
| 791 | // while the fixture goroutine is not done, because the fixture must be |
| 792 | // run in a desired order. |
| 793 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) runFixturescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFixture().(method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#, testName string, logb *loggerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#) *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# { |
| 794 | if method != nil { |
| 795 | c := runner.runFuncscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFunc().(method, fixtureKdscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixtureKd., testName, logb, func(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 796 | c.ResetTimerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#ResetTimer().() |
| 797 | c.StartTimerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#StartTimer().() |
| 798 | defer c.StopTimerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#StopTimer().() |
| 799 | c.methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method..Callscip-go gomod github.com/golang/go/src go1.13 reflect/Value#Call().([]reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.Valuescip-go gomod github.com/golang/go/src go1.13 reflect/Value#{reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.13 reflect/ValueOf().(c)}) |
| 800 | }) |
| 801 | return c |
| 802 | } |
| 803 | return nil |
| 804 | } |
| 805 | |
| 806 | // Run the fixture method with runFixture(), but panic with a fixturePanic{} |
| 807 | // in case the fixture method panics. This makes it easier to track the |
| 808 | // fixture panic together with other call panics within forkTest(). |
| 809 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) runFixtureWithPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFixtureWithPanic().(method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#, testName string, logb *loggerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#, skipped *bool) *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# { |
| 810 | if skipped != nil && *skipped { |
| 811 | return nil |
| 812 | } |
| 813 | c := runner.runFixturescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFixture().(method, testName, logb) |
| 814 | if c != nil && c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() != succeededStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/succeededSt. { |
| 815 | if skipped != nil { |
| 816 | *skipped = c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() == skippedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/skippedSt. |
| 817 | } |
| 818 | panic(&fixturePanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanic#{c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().(), method}) |
| 819 | } |
| 820 | return c |
| 821 | } |
| 822 | |
| 823 | type fixturePanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanic# struct { |
| 824 | statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanic#status. funcStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcStatus# |
| 825 | methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanic#method. *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType# |
| 826 | } |
| 827 | |
| 828 | // Run the suite test method, together with the test-specific fixture, |
| 829 | // asynchronously. |
| 830 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) forkTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#forkTest().(method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#) *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# { |
| 831 | testName := method.Stringscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#String().() |
| 832 | return runner.forkCallscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#forkCall().(method, testKdscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/testKd., testName, nil, func(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 833 | var skipped bool |
| 834 | defer runner.runFixtureWithPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFixtureWithPanic().(runner.tearDownTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tearDownTest., testName, nil, &skipped) |
| 835 | defer c.StopTimerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#StopTimer().() |
| 836 | benchN := 1 |
| 837 | for { |
| 838 | runner.runFixtureWithPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFixtureWithPanic().(runner.setUpTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#setUpTest., testName, c.logbscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logb., &skipped) |
| 839 | mt := c.methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method..Typescip-go gomod github.com/golang/go/src go1.13 reflect/Value#Type().() |
| 840 | if mt.NumInscip-go gomod github.com/golang/go/src go1.13 reflect/Type#NumIn().() != 1 || mt.Inscip-go gomod github.com/golang/go/src go1.13 reflect/Type#In().(0) != reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.13 reflect/TypeOf().(c) { |
| 841 | // Rather than a plain panic, provide a more helpful message when |
| 842 | // the argument type is incorrect. |
| 843 | c.setStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#setStatus().(panickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/panickedSt.) |
| 844 | c.logArgPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logArgPanic().(c.methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method., "*check.C") |
| 845 | return |
| 846 | } |
| 847 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.13 strings/HasPrefix().(c.methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method..Infoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Info..Namescip-go gomod github.com/golang/go/src go1.13 reflect/Method#Name., "Test") { |
| 848 | c.ResetTimerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#ResetTimer().() |
| 849 | c.StartTimerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#StartTimer().() |
| 850 | c.methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method..Callscip-go gomod github.com/golang/go/src go1.13 reflect/Value#Call().([]reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.Valuescip-go gomod github.com/golang/go/src go1.13 reflect/Value#{reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.13 reflect/ValueOf().(c)}) |
| 851 | return |
| 852 | } |
| 853 | if !stringsscip-go gomod github.com/golang/go/src go1.13 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.13 strings/HasPrefix().(c.methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method..Infoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Info..Namescip-go gomod github.com/golang/go/src go1.13 reflect/Method#Name., "Benchmark") { |
| 854 | panic("unexpected method prefix: " + c.methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method..Infoscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#Info..Namescip-go gomod github.com/golang/go/src go1.13 reflect/Method#Name.) |
| 855 | } |
| 856 | |
| 857 | runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.GCscip-go gomod github.com/golang/go/src go1.13 runtime/GC().() |
| 858 | c.Nscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timer#N. = benchN |
| 859 | c.ResetTimerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#ResetTimer().() |
| 860 | c.StartTimerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#StartTimer().() |
| 861 | c.methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method..Callscip-go gomod github.com/golang/go/src go1.13 reflect/Value#Call().([]reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.Valuescip-go gomod github.com/golang/go/src go1.13 reflect/Value#{reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.13 reflect/ValueOf().(c)}) |
| 862 | c.StopTimerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#StopTimer().() |
| 863 | if c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() != succeededStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/succeededSt. || c.durationscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timer#duration. >= c.benchTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timer#benchTime. || benchN >= 1e9 { |
| 864 | return |
| 865 | } |
| 866 | perOpN := int(1e9) |
| 867 | if c.nsPerOpscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#nsPerOp().() != 0 { |
| 868 | perOpN = int(c.benchTimescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timer#benchTime..Nanosecondsscip-go gomod github.com/golang/go/src go1.13 time/Duration#Nanoseconds().() / c.nsPerOpscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#nsPerOp().()) |
| 869 | } |
| 870 | |
| 871 | // Logic taken from the stock testing package: |
| 872 | // - Run more iterations than we think we'll need for a second (1.5x). |
| 873 | // - Don't grow too fast in case we had timing errors previously. |
| 874 | // - Be sure to run at least one more than last time. |
| 875 | benchN = maxscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/max().(minscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/min().(perOpN+perOpN/2, 100*benchN), benchN+1) |
| 876 | benchN = roundUpscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/roundUp().(benchN) |
| 877 | |
| 878 | skipped = true // Don't run the deferred one if this panics. |
| 879 | runner.runFixtureWithPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFixtureWithPanic().(runner.tearDownTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tearDownTest., testName, nil, nil) |
| 880 | skipped = false |
| 881 | } |
| 882 | }) |
| 883 | } |
| 884 | |
| 885 | // Same as forkTest(), but wait for the test to finish before returning. |
| 886 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) runTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runTest().(method *methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#) *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C# { |
| 887 | c := runner.forkTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#forkTest().(method) |
| 888 | <-c.donescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#done. |
| 889 | return c |
| 890 | } |
| 891 | |
| 892 | // Helper to mark tests as skipped or missed. A bit heavy for what |
| 893 | // it does, but it enables homogeneous handling of tracking, including |
| 894 | // nice verbose output. |
| 895 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) skipTestsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#skipTests().(status funcStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/funcStatus#, methods []*methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#) { |
| 896 | for _, method := range methods { |
| 897 | runner.runFuncscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFunc().(method, testKdscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/testKd., "", nil, func(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 898 | c.setStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#setStatus().(status) |
| 899 | }) |
| 900 | } |
| 901 | } |
| 902 | |
| 903 | // Verify if the fixture arguments are *check.C. In case of errors, |
| 904 | // log the error as a panic in the fixture method call, and return false. |
| 905 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) checkFixtureArgsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#checkFixtureArgs().() bool { |
| 906 | succeeded := true |
| 907 | argType := reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.13 reflect/TypeOf().(&Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#{}) |
| 908 | for _, method := range []*methodTypescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#{runner.setUpSuitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#setUpSuite., runner.tearDownSuitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tearDownSuite., runner.setUpTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#setUpTest., runner.tearDownTestscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tearDownTest.} { |
| 909 | if method != nil { |
| 910 | mt := method.Typescip-go gomod github.com/golang/go/src go1.13 reflect/Value#Type().() |
| 911 | if mt.NumInscip-go gomod github.com/golang/go/src go1.13 reflect/Type#NumIn().() != 1 || mt.Inscip-go gomod github.com/golang/go/src go1.13 reflect/Type#In().(0) != argType { |
| 912 | succeeded = false |
| 913 | runner.runFuncscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#runFunc().(method, fixtureKdscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixtureKd., "", nil, func(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 914 | c.logArgPanicscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logArgPanic().(method, "*check.C") |
| 915 | c.setStatusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#setStatus().(panickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/panickedSt.) |
| 916 | }) |
| 917 | } |
| 918 | } |
| 919 | } |
| 920 | return succeeded |
| 921 | } |
| 922 | |
| 923 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) reportCallStartedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#reportCallStarted().(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 924 | runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output..WriteCallStartedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallStarted().("START", c) |
| 925 | } |
| 926 | |
| 927 | func (runner *suiteRunnerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#) reportCallDonescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#reportCallDone().(c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 928 | runner.trackerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#tracker..callDonescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/resultTracker#callDone().(c) |
| 929 | switch c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() { |
| 930 | case succeededStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/succeededSt.: |
| 931 | if c.mustFailscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#mustFail. { |
| 932 | runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output..WriteCallSuccessscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallSuccess().("FAIL EXPECTED", c) |
| 933 | } else { |
| 934 | runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output..WriteCallSuccessscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallSuccess().("PASS", c) |
| 935 | } |
| 936 | case skippedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/skippedSt.: |
| 937 | runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output..WriteCallSuccessscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallSuccess().("SKIP", c) |
| 938 | case failedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/failedSt.: |
| 939 | runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output..WriteCallProblemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallProblem().("FAIL", c) |
| 940 | case timeoutStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timeoutSt.: |
| 941 | runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output..WriteCallProblemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallProblem().("TIMEOUT", c) |
| 942 | case panickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/panickedSt.: |
| 943 | runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output..WriteCallProblemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallProblem().("PANIC", c) |
| 944 | case fixturePanickedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/fixturePanickedSt.: |
| 945 | // That's a testKd call reporting that its fixture |
| 946 | // has panicked. The fixture call which caused the |
| 947 | // panic itself was tracked above. We'll report to |
| 948 | // aid debugging. |
| 949 | runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output..WriteCallProblemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallProblem().("PANIC", c) |
| 950 | case missedStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/missedSt.: |
| 951 | runner.outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/suiteRunner#output..WriteCallSuccessscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallSuccess().("MISS", c) |
| 952 | } |
| 953 | } |
| 954 | |
| 955 | // ----------------------------------------------------------------------- |
| 956 | // Output writer manages atomic output writing according to settings. |
| 957 | |
| 958 | type outputWriterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter# struct { |
| 959 | mscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#m. syncscip-go gomod github.com/golang/go/src go1.13 sync/.Mutexscip-go gomod github.com/golang/go/src go1.13 sync/Mutex# |
| 960 | writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#writer. ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer# |
| 961 | wroteCallProblemLastscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#wroteCallProblemLast. bool |
| 962 | Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Stream. bool |
| 963 | Verbosescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Verbose. bool |
| 964 | } |
| 965 | |
| 966 | func newOutputWriterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/newOutputWriter().(writer ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer#, stream, verbose bool) *outputWriterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter# { |
| 967 | return &outputWriterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#{writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#writer.: writer, Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Stream.: stream, Verbosescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Verbose.: verbose} |
| 968 | } |
| 969 | |
| 970 | func (ow *outputWriterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#) Writescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Write().(content []byte) (n int, err error) { |
| 971 | ow.mscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#m..Lockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Lock().() |
| 972 | n, err = ow.writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#writer..Writescip-go gomod github.com/golang/go/src go1.13 io/Writer#Write().(content) |
| 973 | ow.mscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#m..Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Unlock().() |
| 974 | return |
| 975 | } |
| 976 | |
| 977 | func (ow *outputWriterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#) WriteCallStartedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallStarted().(label string, c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 978 | if ow.Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Stream. { |
| 979 | header := renderCallHeaderscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/renderCallHeader().(label, c, "", "\n") |
| 980 | ow.mscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#m..Lockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Lock().() |
| 981 | ow.writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#writer..Writescip-go gomod github.com/golang/go/src go1.13 io/Writer#Write().([]byte(header)) |
| 982 | ow.mscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#m..Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Unlock().() |
| 983 | } |
| 984 | } |
| 985 | |
| 986 | func (ow *outputWriterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#) WriteCallProblemscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallProblem().(label string, c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 987 | var prefix string |
| 988 | if !ow.Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Stream. { |
| 989 | prefix = "\n-----------------------------------" + |
| 990 | "-----------------------------------\n" |
| 991 | } |
| 992 | header := renderCallHeaderscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/renderCallHeader().(label, c, prefix, "\n\n") |
| 993 | ow.mscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#m..Lockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Lock().() |
| 994 | ow.wroteCallProblemLastscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#wroteCallProblemLast. = true |
| 995 | ow.writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#writer..Writescip-go gomod github.com/golang/go/src go1.13 io/Writer#Write().([]byte(header)) |
| 996 | if !ow.Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Stream. { |
| 997 | c.logbscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#logb..WriteToscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/logger#WriteTo().(ow.writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#writer.) |
| 998 | } |
| 999 | ow.mscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#m..Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Unlock().() |
| 1000 | } |
| 1001 | |
| 1002 | func (ow *outputWriterscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#) WriteCallSuccessscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#WriteCallSuccess().(label string, c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 1003 | if ow.Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Stream. || (ow.Verbosescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Verbose. && c.kindscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#kind. == testKdscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/testKd.) { |
| 1004 | // TODO Use a buffer here. |
| 1005 | var suffix string |
| 1006 | if c.reasonscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#reason. != "" { |
| 1007 | suffix = " (" + c.reasonscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#reason. + ")" |
| 1008 | } |
| 1009 | if c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() == succeededStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/succeededSt. || c.statusscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#status().() == timeoutStscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/timeoutSt. { |
| 1010 | suffix += "\t" + c.timerStringscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#timerString().() |
| 1011 | } |
| 1012 | suffix += "\n" |
| 1013 | if ow.Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Stream. { |
| 1014 | suffix += "\n" |
| 1015 | } |
| 1016 | header := renderCallHeaderscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/renderCallHeader().(label, c, "", suffix) |
| 1017 | ow.mscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#m..Lockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Lock().() |
| 1018 | // Resist temptation of using line as prefix above due to race. |
| 1019 | if !ow.Streamscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#Stream. && ow.wroteCallProblemLastscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#wroteCallProblemLast. { |
| 1020 | header = "\n-----------------------------------" + |
| 1021 | "-----------------------------------\n" + |
| 1022 | header |
| 1023 | } |
| 1024 | ow.wroteCallProblemLastscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#wroteCallProblemLast. = false |
| 1025 | ow.writerscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#writer..Writescip-go gomod github.com/golang/go/src go1.13 io/Writer#Write().([]byte(header)) |
| 1026 | ow.mscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/outputWriter#m..Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Mutex#Unlock().() |
| 1027 | } |
| 1028 | } |
| 1029 | |
| 1030 | func renderCallHeaderscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/renderCallHeader().(label string, c *Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#, prefix, suffix string) string { |
| 1031 | pc := c.methodscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#method..PCscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/methodType#PC().() |
| 1032 | return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%s%s: %s: %s%s", prefix, label, niceFuncPathscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/niceFuncPath().(pc), |
| 1033 | niceFuncNamescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/niceFuncName().(pc), suffix) |
| 1034 | } |