Commit 76730696 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Suppress log messages of handle_test.

parent a8d84251
...@@ -6,12 +6,13 @@ import ( ...@@ -6,12 +6,13 @@ import (
"testing" "testing"
"unsafe" "unsafe"
) )
var _ = log.Println
func markSeen(substr string) { func markSeen(t *testing.T, substr string) {
if r := recover(); r != nil { if r := recover(); r != nil {
s := r.(string) s := r.(string)
if strings.Contains(s, substr) { if strings.Contains(s, substr) {
log.Println("expected recovery from: ", r) t.Log("expected recovery from: ", r)
} else { } else {
panic(s) panic(s)
} }
...@@ -24,7 +25,7 @@ func TestHandleMapDoubleRegister(t *testing.T) { ...@@ -24,7 +25,7 @@ func TestHandleMapDoubleRegister(t *testing.T) {
return return
} }
t.Log("TestDoubleRegister") t.Log("TestDoubleRegister")
defer markSeen("already has a handle") defer markSeen(t, "already has a handle")
hm := NewHandleMap(false) hm := NewHandleMap(false)
obj := &Handled{} obj := &Handled{}
hm.Register(obj, obj) hm.Register(obj, obj)
...@@ -44,7 +45,7 @@ func TestHandleMapUnaligned(t *testing.T) { ...@@ -44,7 +45,7 @@ func TestHandleMapUnaligned(t *testing.T) {
b := make([]byte, 100) b := make([]byte, 100)
v := (*Handled)(unsafe.Pointer(&b[1])) v := (*Handled)(unsafe.Pointer(&b[1]))
defer markSeen("unaligned") defer markSeen(t, "unaligned")
hm.Register(v, v) hm.Register(v, v)
t.Error("Unaligned register did not panic") t.Error("Unaligned register did not panic")
} }
...@@ -59,7 +60,7 @@ func TestHandleMapPointerLayout(t *testing.T) { ...@@ -59,7 +60,7 @@ func TestHandleMapPointerLayout(t *testing.T) {
bogus := uint64(1) << uint32((8 * (unsafe.Sizeof(t) - 1))) bogus := uint64(1) << uint32((8 * (unsafe.Sizeof(t) - 1)))
p := uintptr(bogus) p := uintptr(bogus)
v := (*Handled)(unsafe.Pointer(p)) v := (*Handled)(unsafe.Pointer(p))
defer markSeen("48") defer markSeen(t, "48")
hm.Register(v, v) hm.Register(v, v)
t.Error("bogus register did not panic") t.Error("bogus register did not panic")
} }
...@@ -111,7 +112,7 @@ func TestHandleMapCheckFail(t *testing.T) { ...@@ -111,7 +112,7 @@ func TestHandleMapCheckFail(t *testing.T) {
t.Log("skipping test for 32 bits") t.Log("skipping test for 32 bits")
return return
} }
defer markSeen("check mismatch") defer markSeen(t, "check mismatch")
v := new(Handled) v := new(Handled)
hm := NewHandleMap(false) hm := NewHandleMap(false)
......
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