haveExamples = len(examples) > 0
testOk := RunTests(matchString, tests)
exampleOk := RunExamples(matchString, examples)
+ stopAlarm()
if !testOk || !exampleOk {
fmt.Println("FAIL")
os.Exit(1)
}
fmt.Println("PASS")
- stopAlarm()
RunBenchmarks(matchString, benchmarks)
after()
}
// startAlarm starts an alarm if requested.
func startAlarm() {
if *timeout > 0 {
- timer = time.AfterFunc(*timeout, alarm)
+ timer = time.AfterFunc(*timeout, func() {
+ panic(fmt.Sprintf("test timed out after %v", *timeout))
+ })
}
}
}
}
-// alarm is called if the timeout expires.
-func alarm() {
- panic("test timed out")
-}
-
func parseCpuList() {
if len(*cpuListStr) == 0 {
cpuList = append(cpuList, runtime.GOMAXPROCS(-1))