@@ -14,6 +14,7 @@ import (
14
14
"os/exec"
15
15
"path/filepath"
16
16
"regexp"
17
+ "runtime"
17
18
"strconv"
18
19
"strings"
19
20
"time"
@@ -24,7 +25,9 @@ func cmdtest() {
24
25
flag .BoolVar (& t .listMode , "list" , false , "list available tests" )
25
26
flag .BoolVar (& t .noRebuild , "no-rebuild" , false , "don't rebuild std and cmd packages" )
26
27
flag .StringVar (& t .banner , "banner" , "##### " , "banner prefix; blank means no section banners" )
27
- flag .StringVar (& t .runRxStr , "run" , "" , "run only those tests matching the regular expression; empty means to run all" )
28
+ flag .StringVar (& t .runRxStr , "run" , os .Getenv ("GOTESTONLY" ),
29
+ "run only those tests matching the regular expression; empty means to run all. " +
30
+ "Special exception: if the string begins with '!', the match is inverted." )
28
31
xflagparse (0 )
29
32
t .run ()
30
33
}
@@ -35,6 +38,7 @@ type tester struct {
35
38
noRebuild bool
36
39
runRxStr string
37
40
runRx * regexp.Regexp
41
+ runRxWant bool
38
42
banner string // prefix, or "" for none
39
43
40
44
goroot string
@@ -129,6 +133,19 @@ func (t *tester) run() {
129
133
}
130
134
131
135
if t .runRxStr != "" {
136
+ // Temporary (2015-05-14) special case for "std",
137
+ // which the plan9 builder was using for ages. Delete
138
+ // this once we update dashboard/builders.go to use a
139
+ // regexp instead.
140
+ if runtime .GOOS == "plan9" && t .runRxStr == "std" {
141
+ t .runRxStr = "^go_test:"
142
+ }
143
+ if t .runRxStr [0 ] == '!' {
144
+ t .runRxWant = false
145
+ t .runRxStr = t .runRxStr [1 :]
146
+ } else {
147
+ t .runRxWant = true
148
+ }
132
149
t .runRx = regexp .MustCompile (t .runRxStr )
133
150
}
134
151
@@ -147,7 +164,7 @@ func (t *tester) run() {
147
164
148
165
var lastHeading string
149
166
for _ , dt := range t .tests {
150
- if t .runRx != nil && ! t .runRx .MatchString (dt .name ) {
167
+ if t .runRx != nil && ( t .runRx .MatchString (dt .name ) != t . runRxWant ) {
151
168
t .partial = true
152
169
continue
153
170
}
@@ -214,13 +231,6 @@ func (t *tester) registerTests() {
214
231
})
215
232
}
216
233
217
- // Old hack for when Plan 9 on GCE was too slow.
218
- // We're keeping this until test sharding (Issue 10029) is finished, though.
219
- if os .Getenv ("GOTESTONLY" ) == "std" {
220
- t .partial = true
221
- return
222
- }
223
-
224
234
// Runtime CPU tests.
225
235
testName := "runtime:cpu124"
226
236
t .tests = append (t .tests , distTest {
0 commit comments