testing: use flag.Duration for -timeout flag.

R=golang-dev, gustavo, r
CC=golang-dev
https://golang.org/cl/5498077
This commit is contained in:
David Symonds 2011-12-25 16:07:05 +11:00
parent d5e45e3a8a
commit 57c9bb4a07
4 changed files with 7 additions and 7 deletions

View file

@ -63,7 +63,7 @@ var (
memProfile = flag.String("test.memprofile", "", "write a memory profile to the named file after execution")
memProfileRate = flag.Int("test.memprofilerate", 0, "if >=0, sets runtime.MemProfileRate")
cpuProfile = flag.String("test.cpuprofile", "", "write a cpu profile to the named file during execution")
timeout = flag.Int64("test.timeout", 0, "if > 0, sets time limit for tests in seconds")
timeout = flag.Duration("test.timeout", 0, "if positive, sets an aggregate time limit for all tests")
cpuListStr = flag.String("test.cpu", "", "comma-separated list of number of CPUs to use for each test")
parallel = flag.Int("test.parallel", runtime.GOMAXPROCS(0), "maximum test parallelism")
@ -346,7 +346,7 @@ var timer *time.Timer
// startAlarm starts an alarm if requested.
func startAlarm() {
if *timeout > 0 {
timer = time.AfterFunc(time.Duration(*timeout)*time.Second, alarm)
timer = time.AfterFunc(*timeout, alarm)
}
}