Commit e6b02347 authored by Rémy Oudompheng's avatar Rémy Oudompheng

runtime: reduce delays in finalizer test.

The runtime tests are executed 4 times in all.bash
and there is currently a 5-second delay each time.

R=golang-dev, minux.ma, khr, bradfitz
CC=golang-dev
https://golang.org/cl/42450043
parent 16dcef80
...@@ -46,13 +46,15 @@ func TestFinalizerType(t *testing.T) { ...@@ -46,13 +46,15 @@ func TestFinalizerType(t *testing.T) {
} }
for _, tt := range finalizerTests { for _, tt := range finalizerTests {
done := make(chan bool, 1)
go func() { go func() {
v := new(int) v := new(int)
*v = 97531 *v = 97531
runtime.SetFinalizer(tt.convert(v), tt.finalizer) runtime.SetFinalizer(tt.convert(v), tt.finalizer)
v = nil v = nil
done <- true
}() }()
time.Sleep(1 * time.Second) <-done
runtime.GC() runtime.GC()
select { select {
case <-ch: case <-ch:
...@@ -73,6 +75,7 @@ func TestFinalizerInterfaceBig(t *testing.T) { ...@@ -73,6 +75,7 @@ func TestFinalizerInterfaceBig(t *testing.T) {
t.Skipf("Skipping on non-amd64 machine") t.Skipf("Skipping on non-amd64 machine")
} }
ch := make(chan bool) ch := make(chan bool)
done := make(chan bool, 1)
go func() { go func() {
v := &bigValue{0xDEADBEEFDEADBEEF, true, "It matters not how strait the gate"} v := &bigValue{0xDEADBEEFDEADBEEF, true, "It matters not how strait the gate"}
old := *v old := *v
...@@ -87,8 +90,9 @@ func TestFinalizerInterfaceBig(t *testing.T) { ...@@ -87,8 +90,9 @@ func TestFinalizerInterfaceBig(t *testing.T) {
close(ch) close(ch)
}) })
v = nil v = nil
done <- true
}() }()
time.Sleep(1 * time.Second) <-done
runtime.GC() runtime.GC()
select { select {
case <-ch: case <-ch:
......
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