Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(671)

Delta Between Two Patch Sets: src/cmd/gotest/flag.go

Issue 5071044: code review 5071044: testing: Add support for running tests in parallel (t.P... (Closed)
Left Patch Set: diff -r f400d3afc555 https://go.googlecode.com/hg/ Created 13 years, 5 months ago
Right Patch Set: diff -r 3c7f031ee62b https://go.googlecode.com/hg/ Created 13 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/testing/testing.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(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 10 matching lines...) Expand all
21 -file=file: 21 -file=file:
22 -x=false: print command lines as they are executed 22 -x=false: print command lines as they are executed
23 23
24 // These flags can be passed with or without a "test." prefix: -v or -test.v. 24 // These flags can be passed with or without a "test." prefix: -v or -test.v.
25 -bench="": passes -test.bench to test 25 -bench="": passes -test.bench to test
26 -benchtime=1: passes -test.benchtime to test 26 -benchtime=1: passes -test.benchtime to test
27 -cpu="": passes -test.cpu to test 27 -cpu="": passes -test.cpu to test
28 -cpuprofile="": passes -test.cpuprofile to test 28 -cpuprofile="": passes -test.cpuprofile to test
29 -memprofile="": passes -test.memprofile to test 29 -memprofile="": passes -test.memprofile to test
30 -memprofilerate=0: passes -test.memprofilerate to test 30 -memprofilerate=0: passes -test.memprofilerate to test
31 -parallel=0: passes -test.parallel to test
31 -run="": passes -test.run to test 32 -run="": passes -test.run to test
32 -short=false: passes -test.short to test 33 -short=false: passes -test.short to test
33 -timeout=0: passes -test.timeout to test 34 -timeout=0: passes -test.timeout to test
34 -v=false: passes -test.v to test 35 -v=false: passes -test.v to test
35 ` 36 `
36 37
37 // usage prints a usage message and exits. 38 // usage prints a usage message and exits.
38 func usage() { 39 func usage() {
39 fmt.Fprintf(os.Stdout, usageMessage, os.Args[0]) 40 fmt.Fprintf(os.Stdout, usageMessage, os.Args[0])
40 os.Exit(2) 41 os.Exit(2)
(...skipping 15 matching lines...) Expand all
56 &flagSpec{name: "file", multiOK: true}, 57 &flagSpec{name: "file", multiOK: true},
57 &flagSpec{name: "x", isBool: true}, 58 &flagSpec{name: "x", isBool: true},
58 59
59 // passed to 6.out, adding a "test." prefix to the name if necessary: -v becomes -test.v. 60 // passed to 6.out, adding a "test." prefix to the name if necessary: -v becomes -test.v.
60 &flagSpec{name: "bench", passToTest: true}, 61 &flagSpec{name: "bench", passToTest: true},
61 &flagSpec{name: "benchtime", passToTest: true}, 62 &flagSpec{name: "benchtime", passToTest: true},
62 &flagSpec{name: "cpu", passToTest: true}, 63 &flagSpec{name: "cpu", passToTest: true},
63 &flagSpec{name: "cpuprofile", passToTest: true}, 64 &flagSpec{name: "cpuprofile", passToTest: true},
64 &flagSpec{name: "memprofile", passToTest: true}, 65 &flagSpec{name: "memprofile", passToTest: true},
65 &flagSpec{name: "memprofilerate", passToTest: true}, 66 &flagSpec{name: "memprofilerate", passToTest: true},
67 &flagSpec{name: "parallel", passToTest: true},
66 &flagSpec{name: "run", passToTest: true}, 68 &flagSpec{name: "run", passToTest: true},
67 &flagSpec{name: "short", isBool: true, passToTest: true}, 69 &flagSpec{name: "short", isBool: true, passToTest: true},
68 &flagSpec{name: "timeout", passToTest: true}, 70 &flagSpec{name: "timeout", passToTest: true},
69 &flagSpec{name: "v", isBool: true, passToTest: true}, 71 &flagSpec{name: "v", isBool: true, passToTest: true},
70 } 72 }
71 73
72 // flags processes the command line, grabbing -x and -c, rewriting known flags 74 // flags processes the command line, grabbing -x and -c, rewriting known flags
73 // to have "test" before them, and reading the command line for the 6.out. 75 // to have "test" before them, and reading the command line for the 6.out.
74 // Unfortunately for us, we need to do our own flag processing because gotest 76 // Unfortunately for us, we need to do our own flag processing because gotest
75 // grabs some flags but otherwise its command line is just a holding place for 77 // grabs some flags but otherwise its command line is just a holding place for
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 152
151 // setBoolFlag sets the addressed boolean to the value. 153 // setBoolFlag sets the addressed boolean to the value.
152 func setBoolFlag(flag *bool, value string) { 154 func setBoolFlag(flag *bool, value string) {
153 x, err := strconv.Atob(value) 155 x, err := strconv.Atob(value)
154 if err != nil { 156 if err != nil {
155 fmt.Fprintf(os.Stderr, "gotest: illegal bool flag value %s\n", v alue) 157 fmt.Fprintf(os.Stderr, "gotest: illegal bool flag value %s\n", v alue)
156 usage() 158 usage()
157 } 159 }
158 *flag = x 160 *flag = x
159 } 161 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b