Commit b354f914 authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: limit TestCgoCCodeSIGPROF test to 1 second

Still fails about 20% of the time on my laptop.

Fixes #14766.

Change-Id: I169ab728c6022dceeb91188f5ad466ed6413c062
Reviewed-on: https://go-review.googlesource.com/20590
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent def9c0b0
...@@ -17,6 +17,7 @@ import ( ...@@ -17,6 +17,7 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"runtime/pprof" "runtime/pprof"
"time"
) )
func init() { func init() {
...@@ -31,7 +32,13 @@ func CgoCCodeSIGPROF() { ...@@ -31,7 +32,13 @@ func CgoCCodeSIGPROF() {
go func() { go func() {
for { for {
<-c <-c
start := time.Now()
for i := 0; i < 1e7; i++ { for i := 0; i < 1e7; i++ {
if i%1000 == 0 {
if time.Since(start) > time.Second {
break
}
}
C.GoNop() C.GoNop()
} }
c <- true c <- true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment