LEFT | RIGHT |
(no file at all) | |
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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 // alarm is called if the timeout expires. | 281 // alarm is called if the timeout expires. |
282 func alarm() { | 282 func alarm() { |
283 panic("test timed out") | 283 panic("test timed out") |
284 } | 284 } |
285 | 285 |
286 func parseCpuList() { | 286 func parseCpuList() { |
287 if len(*cpuListStr) == 0 { | 287 if len(*cpuListStr) == 0 { |
288 cpuList = append(cpuList, runtime.GOMAXPROCS(-1)) | 288 cpuList = append(cpuList, runtime.GOMAXPROCS(-1)) |
289 } else { | 289 } else { |
290 » » for _, val := range strings.Split(*cpuListStr, ",", -1) { | 290 » » for _, val := range strings.Split(*cpuListStr, ",") { |
291 cpu, err := strconv.Atoi(val) | 291 cpu, err := strconv.Atoi(val) |
292 if err != nil || cpu <= 0 { | 292 if err != nil || cpu <= 0 { |
293 println("invalid value for -test.cpu") | 293 println("invalid value for -test.cpu") |
294 os.Exit(1) | 294 os.Exit(1) |
295 } | 295 } |
296 cpuList = append(cpuList, cpu) | 296 cpuList = append(cpuList, cpu) |
297 } | 297 } |
298 } | 298 } |
299 } | 299 } |
LEFT | RIGHT |