1
0
mirror of https://github.com/golang/go synced 2024-11-25 13:07:57 -07:00

runtime: make new tests shorter in short mode

We see timeouts in these tests on some platforms,
but not on the others.  The hypothesis is that
the problematic platforms are slow uniprocessors.
Stack traces do not suggest that the process
is completely hang, and it is able to schedule
the alarm goroutine. And if it actually hangs,
we still will be able to detect that.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12253043
This commit is contained in:
Dmitriy Vyukov 2013-08-01 18:25:36 +04:00
parent bd0a14fe40
commit d8bbbd2537

View File

@ -94,9 +94,14 @@ func TestYieldLocked(t *testing.T) {
}
func TestGoroutineParallelism(t *testing.T) {
const P = 4
P := 4
N := 10
if testing.Short() {
P = 3
N = 3
}
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(P))
for try := 0; try < 10; try++ {
for try := 0; try < N; try++ {
done := make(chan bool)
x := uint32(0)
for p := 0; p < P; p++ {
@ -194,7 +199,10 @@ var preempt = func() int {
func TestPreemption(t *testing.T) {
// Test that goroutines are preempted at function calls.
const N = 5
N := 5
if testing.Short() {
N = 2
}
c := make(chan bool)
var x uint32
for g := 0; g < 2; g++ {
@ -214,7 +222,12 @@ func TestPreemption(t *testing.T) {
func TestPreemptionGC(t *testing.T) {
// Test that pending GC preempts running goroutines.
const P = 5
P := 5
N := 10
if testing.Short() {
P = 3
N = 2
}
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(P + 1))
var stop uint32
for i := 0; i < P; i++ {
@ -224,7 +237,7 @@ func TestPreemptionGC(t *testing.T) {
}
}()
}
for i := 0; i < 10; i++ {
for i := 0; i < N; i++ {
runtime.Gosched()
runtime.GC()
}