-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
187 lines (186 loc) · 7.05 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
package benchy
//-bench regexp
// Run only those benchmarks matching a regular expression.
// By default, no benchmarks are run.
// To run all benchmarks, use '-bench .' or '-bench=.'.
// The regular expression is split by unbracketed slash (/)
// characters into a sequence of regular expressions, and each
// part of a benchmark's identifier must match the corresponding
// element in the sequence, if any. Possible parents of matches
// are run with b.N=1 to identify sub-benchmarks. For example,
// given -bench=X/Y, top-level benchmarks matching X are run
// with b.N=1 to find any sub-benchmarks matching Y, which are
// then run in full.
//
//-benchtime t
// Run enough iterations of each benchmark to take t, specified
// as a time.Duration (for example, -benchtime 1h30s).
// The default is 1 second (1s).
// The special syntax Nx means to run the benchmark N times
// (for example, -benchtime 100x).
//
//-count n
// Run each test and benchmark n times (default 1).
// If -cpu is set, run n times for each GOMAXPROCS value.
// Examples are always run once.
//
//-cover
// Enable coverage analysis.
// Note that because coverage works by annotating the source
// code before compilation, compilation and test failures with
// coverage enabled may report line numbers that don't correspond
// to the original sources.
//
//-covermode set,count,atomic
// Set the mode for coverage analysis for the package[s]
// being tested. The default is "set" unless -race is enabled,
// in which case it is "atomic".
// The values:
// set: bool: does this statement run?
// count: int: how many times does this statement run?
// atomic: int: count, but correct in multithreaded tests;
// significantly more expensive.
// Sets -cover.
//
//-coverpkg pattern1,pattern2,pattern3
// Apply coverage analysis in each test to packages matching the patterns.
// The default is for each test to analyze only the package being tested.
// See 'go help packages' for a description of package patterns.
// Sets -cover.
//
//-cpu 1,2,4
// Specify a list of GOMAXPROCS values for which the tests or
// benchmarks should be executed. The default is the current value
// of GOMAXPROCS.
//
//-failfast
// Do not start new tests after the first test failure.
//
//-list regexp
// List tests, benchmarks, or examples matching the regular expression.
// No tests, benchmarks or examples will be run. This will only
// list top-level tests. No subtest or subbenchmarks will be shown.
//
//-parallel n
// Allow parallel execution of test functions that call t.Parallel.
// The value of this flag is the maximum number of tests to run
// simultaneously; by default, it is set to the value of GOMAXPROCS.
// Note that -parallel only applies within a single test binary.
// The 'go test' command may run tests for different packages
// in parallel as well, according to the setting of the -p flag
// (see 'go help build').
//
//-run regexp
// Run only those tests and examples matching the regular expression.
// For tests, the regular expression is split by unbracketed slash (/)
// characters into a sequence of regular expressions, and each part
// of a test's identifier must match the corresponding element in
// the sequence, if any. Note that possible parents of matches are
// run too, so that -run=X/Y matches and runs and reports the result
// of all tests matching X, even those without sub-tests matching Y,
// because it must run them to look for those sub-tests.
//
//-short
// Tell long-running tests to shorten their run time.
// It is off by default but set during all.bash so that installing
// the Go tree can run a sanity check but not spend time running
// exhaustive tests.
//
//-shuffle off,on,N
// Randomize the execution order of tests and benchmarks.
// It is off by default. If -shuffle is set to on, then it will seed
// the randomizer using the system clock. If -shuffle is set to an
// integer N, then N will be used as the seed value. In both cases,
// the seed will be reported for reproducibility.
//
//-timeout d
// If a test binary runs longer than duration d, panic.
// If d is 0, the timeout is disabled.
// The default is 10 minutes (10m).
//
//-v
// Verbose output: log all tests as they are run. Also print all
// text from Log and Logf calls even if the test succeeds.
//
//-vet list
// Configure the invocation of "go vet" during "go test"
// to use the comma-separated list of vet checks.
// If list is empty, "go test" runs "go vet" with a curated list of
// checks believed to be always worth addressing.
// If list is "off", "go test" does not run "go vet" at all.
//
//
//
//
//
//-benchmem
// Print memory allocation statistics for benchmarks.
//
//-blockprofile block.out
// Write a goroutine blocking profile to the specified file
// when all tests are complete.
// Writes test binary as -c would.
//
//-blockprofilerate n
// Control the detail provided in goroutine blocking profiles by
// calling runtime.SetBlockProfileRate with n.
// See 'go doc runtime.SetBlockProfileRate'.
// The profiler aims to sample, on average, one blocking event every
// n nanoseconds the program spends blocked. By default,
// if -test.blockprofile is set without this flag, all blocking events
// are recorded, equivalent to -test.blockprofilerate=1.
//
//-coverprofile cover.out
// Write a coverage profile to the file after all tests have passed.
// Sets -cover.
//
//-cpuprofile cpu.out
// Write a CPU profile to the specified file before exiting.
// Writes test binary as -c would.
//
//-memprofile mem.out
// Write an allocation profile to the file after all tests have passed.
// Writes test binary as -c would.
//
//-memprofilerate n
// Enable more precise (and expensive) memory allocation profiles by
// setting runtime.MemProfileRate. See 'go doc runtime.MemProfileRate'.
// To profile all memory allocations, use -test.memprofilerate=1.
//
//-mutexprofile mutex.out
// Write a mutex contention profile to the specified file
// when all tests are complete.
// Writes test binary as -c would.
//
//-mutexprofilefraction n
// Sample 1 in n stack traces of goroutines holding a
// contended mutex.
//
//-outputdir directory
// Place output files from profiling in the specified directory,
// by default the directory in which "go test" is running.
//
//-trace trace.out
// Write an execution trace to the specified file before exiting.
//
//
//
//
//
//
//
// If a benchmark needs to test performance in a parallel setting, it may use
// the RunParallel helper function; such benchmarks are intended to be used with
// the go test -cpu flag:
//
// func BenchmarkTemplateParallel(b *testing.B) {
// templ := template.Must(template.New("test").Parse("Hello, {{.}}!"))
// b.RunParallel(func(pb *testing.PB) {
// var buf bytes.Buffer
// for pb.Next() {
// buf.Reset()
// templ.Execute(&buf, "World")
// }
// })
// }
//