LEFT | RIGHT |
(no file at all) | |
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 "fmt" | 8 "fmt" |
9 "os" | 9 "os" |
10 "strconv" | 10 "strconv" |
(...skipping 13 matching lines...) Expand all Loading... |
24 -x=false: print command lines as they are executed | 24 -x=false: print command lines as they are executed |
25 | 25 |
26 // These flags can be passed with or without a "test." prefix: -v or -test.v. | 26 // These flags can be passed with or without a "test." prefix: -v or -test.v. |
27 -bench="": passes -test.bench to test | 27 -bench="": passes -test.bench to test |
28 -benchmem=false: print memory allocation statistics for benchmarks | 28 -benchmem=false: print memory allocation statistics for benchmarks |
29 -benchtime=1: passes -test.benchtime to test | 29 -benchtime=1: passes -test.benchtime to test |
30 -cpu="": passes -test.cpu to test | 30 -cpu="": passes -test.cpu to test |
31 -cpuprofile="": passes -test.cpuprofile to test | 31 -cpuprofile="": passes -test.cpuprofile to test |
32 -memprofile="": passes -test.memprofile to test | 32 -memprofile="": passes -test.memprofile to test |
33 -memprofilerate=0: passes -test.memprofilerate to test | 33 -memprofilerate=0: passes -test.memprofilerate to test |
| 34 -blockprofile="": pases -test.blockprofile to test |
| 35 -blockprofilerate=0: passes -test.blockprofilerate to test |
34 -parallel=0: passes -test.parallel to test | 36 -parallel=0: passes -test.parallel to test |
35 -run="": passes -test.run to test | 37 -run="": passes -test.run to test |
36 -short=false: passes -test.short to test | 38 -short=false: passes -test.short to test |
37 -timeout=0: passes -test.timeout to test | 39 -timeout=0: passes -test.timeout to test |
38 -v=false: passes -test.v to test | 40 -v=false: passes -test.v to test |
39 ` | 41 ` |
40 | 42 |
41 // usage prints a usage message and exits. | 43 // usage prints a usage message and exits. |
42 func testUsage() { | 44 func testUsage() { |
43 fmt.Fprint(os.Stderr, usageMessage) | 45 fmt.Fprint(os.Stderr, usageMessage) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 {name: "race", boolVar: &buildRace}, | 77 {name: "race", boolVar: &buildRace}, |
76 | 78 |
77 // passed to 6.out, adding a "test." prefix to the name if necessary: -v
becomes -test.v. | 79 // passed to 6.out, adding a "test." prefix to the name if necessary: -v
becomes -test.v. |
78 {name: "bench", passToTest: true}, | 80 {name: "bench", passToTest: true}, |
79 {name: "benchmem", boolVar: new(bool), passToTest: true}, | 81 {name: "benchmem", boolVar: new(bool), passToTest: true}, |
80 {name: "benchtime", passToTest: true}, | 82 {name: "benchtime", passToTest: true}, |
81 {name: "cpu", passToTest: true}, | 83 {name: "cpu", passToTest: true}, |
82 {name: "cpuprofile", passToTest: true}, | 84 {name: "cpuprofile", passToTest: true}, |
83 {name: "memprofile", passToTest: true}, | 85 {name: "memprofile", passToTest: true}, |
84 {name: "memprofilerate", passToTest: true}, | 86 {name: "memprofilerate", passToTest: true}, |
| 87 {name: "blockprofile", passToTest: true}, |
| 88 {name: "blockprofilerate", passToTest: true}, |
85 {name: "parallel", passToTest: true}, | 89 {name: "parallel", passToTest: true}, |
86 {name: "run", passToTest: true}, | 90 {name: "run", passToTest: true}, |
87 {name: "short", boolVar: new(bool), passToTest: true}, | 91 {name: "short", boolVar: new(bool), passToTest: true}, |
88 {name: "timeout", passToTest: true}, | 92 {name: "timeout", passToTest: true}, |
89 {name: "v", boolVar: &testV, passToTest: true}, | 93 {name: "v", boolVar: &testV, passToTest: true}, |
90 } | 94 } |
91 | 95 |
92 // testFlags processes the command line, grabbing -x and -c, rewriting known fla
gs | 96 // testFlags processes the command line, grabbing -x and -c, rewriting known fla
gs |
93 // to have "test" before them, and reading the command line for the 6.out. | 97 // to have "test" before them, and reading the command line for the 6.out. |
94 // Unfortunately for us, we need to do our own flag processing because go test | 98 // Unfortunately for us, we need to do our own flag processing because go test |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 233 |
230 // setIntFlag sets the addressed integer to the value. | 234 // setIntFlag sets the addressed integer to the value. |
231 func setIntFlag(flag *int, value string) { | 235 func setIntFlag(flag *int, value string) { |
232 x, err := strconv.Atoi(value) | 236 x, err := strconv.Atoi(value) |
233 if err != nil { | 237 if err != nil { |
234 fmt.Fprintf(os.Stderr, "go test: illegal int flag value %s\n", v
alue) | 238 fmt.Fprintf(os.Stderr, "go test: illegal int flag value %s\n", v
alue) |
235 usage() | 239 usage() |
236 } | 240 } |
237 *flag = x | 241 *flag = x |
238 } | 242 } |
LEFT | RIGHT |