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

Delta Between Two Patch Sets: src/pkg/testing/testing.go

Issue 5071044: code review 5071044: testing: Add support for running tests in parallel (t.P... (Closed)
Left Patch Set: diff -r 5dc686c3dda8 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/gotest/flag.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 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 testing provides support for automated testing of Go packages. 5 // Package testing provides support for automated testing of Go packages.
6 // It is intended to be used in concert with the ``gotest'' utility, which autom ates 6 // It is intended to be used in concert with the ``gotest'' utility, which autom ates
7 // execution of any function of the form 7 // execution of any function of the form
8 // func TestXxx(*testing.T) 8 // func TestXxx(*testing.T)
9 // where Xxx can be any alphanumeric string (but the first letter must not be in 9 // where Xxx can be any alphanumeric string (but the first letter must not be in
10 // [a-z]) and serves to identify the test routine. 10 // [a-z]) and serves to identify the test routine.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 out := <-t.ch 230 out := <-t.ch
231 if out == nil { // Parallel run. 231 if out == nil { // Parallel run.
232 numParallel++ 232 numParallel++
233 continue 233 continue
234 } 234 }
235 report(t) 235 report(t)
236 ok = ok && !out.failed 236 ok = ok && !out.failed
237 } 237 }
238 238
239 running := 0 239 running := 0
240 » » for numParallel + running > 0 { 240 » » for numParallel+running > 0 {
241 if running < *parallel && numParallel > 0 { 241 if running < *parallel && numParallel > 0 {
242 startParallel <- true 242 startParallel <- true
243 running++ 243 running++
244 » » » » numParallel -- 244 » » » » numParallel--
r 2011/10/06 03:33:31 did this run through gofmt? there's a space before
tebeka 2011/10/06 16:49:11 Done.
245 continue 245 continue
246 } 246 }
247 t := <-ch 247 t := <-ch
248 report(t) 248 report(t)
249 ok = ok && !t.failed 249 ok = ok && !t.failed
250 running-- 250 running--
251 } 251 }
252 } 252 }
253 253
254 if !ok { 254 if !ok {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 for _, val := range strings.Split(*cpuListStr, ",") { 325 for _, val := range strings.Split(*cpuListStr, ",") {
326 cpu, err := strconv.Atoi(val) 326 cpu, err := strconv.Atoi(val)
327 if err != nil || cpu <= 0 { 327 if err != nil || cpu <= 0 {
328 println("invalid value for -test.cpu") 328 println("invalid value for -test.cpu")
329 os.Exit(1) 329 os.Exit(1)
330 } 330 }
331 cpuList = append(cpuList, cpu) 331 cpuList = append(cpuList, cpu)
332 } 332 }
333 } 333 }
334 } 334 }
LEFTRIGHT

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