Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "fmt" | 9 "fmt" |
10 "go/ast" | 10 "go/ast" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 Verbose output: log all tests as they are run. | 87 Verbose output: log all tests as they are run. |
88 | 88 |
89 -test.run pattern | 89 -test.run pattern |
90 Run only those tests and examples matching the regular | 90 Run only those tests and examples matching the regular |
91 expression. | 91 expression. |
92 | 92 |
93 -test.bench pattern | 93 -test.bench pattern |
94 Run benchmarks matching the regular expression. | 94 Run benchmarks matching the regular expression. |
95 By default, no benchmarks run. | 95 By default, no benchmarks run. |
96 | 96 |
97 -test.benchmem | |
98 Print memory allocation statistics for benchmarks. | |
99 | |
97 -test.cpuprofile cpu.out | 100 -test.cpuprofile cpu.out |
98 Write a CPU profile to the specified file before exiting. | 101 Write a CPU profile to the specified file before exiting. |
99 | 102 |
100 -test.memprofile mem.out | 103 -test.memprofile mem.out |
101 Write a memory profile to the specified file when all tests | 104 Write a memory profile to the specified file when all tests |
102 are complete. | 105 are complete. |
103 | 106 |
104 -test.memprofilerate n | 107 -test.memprofilerate n |
105 Enable more precise (and expensive) memory profiles by setting | 108 Enable more precise (and expensive) memory profiles by setting |
106 runtime.MemProfileRate. See 'godoc runtime MemProfileRate'. | 109 runtime.MemProfileRate. See 'godoc runtime MemProfileRate'. |
107 To profile all memory allocations, use -test.memprofilerate=1 | 110 To profile all memory allocations, use -test.memprofilerate=1 |
108 and set the environment variable GOGC=off to disable the | 111 and set the environment variable GOGC=off to disable the |
109 garbage collector, provided the test can run in the available | 112 garbage collector, provided the test can run in the available |
110 memory without garbage collection. | 113 memory without garbage collection. |
111 | 114 |
112 » -test.blockprofile cont.out | 115 » -test.blockprofile block.out |
113 Write a goroutine blocking profile to the specified file | 116 Write a goroutine blocking profile to the specified file |
114 when all tests are complete. | 117 when all tests are complete. |
115 | 118 |
116 -test.blockprofilerate n | 119 -test.blockprofilerate n |
117 » Controls the fraction of blocking events that are recorded | 120 » Control the detail provided in goroutine blocking profiles by settin g |
118 » and reported in the goroutine blocking profile. The profiler | 121 » runtime.BlockProfileRate to n. See 'godoc runtime BlockProfileRate' . |
119 » aims to sample an average of one blocking event per that many | 122 » The profiler aims to sample, on average, one blocking event every |
r
2012/09/20 18:57:58
s/that many/n/
or else i don't understand this com
| |
120 » CPU cycles. By default all blocking events are recorded. | 123 » n nanoseconds the program spends blocked. By default, |
r
2012/09/20 18:57:58
by default, what is the value of n?
i guess i don'
dvyukov
2012/09/20 20:01:29
The default value of n is 1.
| |
124 » if -test.blockprofile is set without this flag, all blocking events | |
125 » are recorded, equivalent to -test.blockprofilerate=1. | |
121 | 126 |
122 -test.parallel n | 127 -test.parallel n |
123 Allow parallel execution of test functions that call t.Parallel. | 128 Allow parallel execution of test functions that call t.Parallel. |
124 The value of this flag is the maximum number of tests to run | 129 The value of this flag is the maximum number of tests to run |
125 simultaneously; by default, it is set to the value of GOMAXPROCS. | 130 simultaneously; by default, it is set to the value of GOMAXPROCS. |
126 | 131 |
127 -test.short | 132 -test.short |
128 Tell long-running tests to shorten their run time. | 133 Tell long-running tests to shorten their run time. |
129 It is off by default but set during all.bash so that installing | 134 It is off by default but set during all.bash so that installing |
130 the Go tree can run a sanity check but not spend time running | 135 the Go tree can run a sanity check but not spend time running |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
838 } | 843 } |
839 } | 844 } |
840 return matchRe.MatchString(str), nil | 845 return matchRe.MatchString(str), nil |
841 } | 846 } |
842 | 847 |
843 func main() { | 848 func main() { |
844 testing.Main(matchString, tests, benchmarks, examples) | 849 testing.Main(matchString, tests, benchmarks, examples) |
845 } | 850 } |
846 | 851 |
847 `)) | 852 `)) |
LEFT | RIGHT |