diff options
Diffstat (limited to 'device/alignment_test.go')
-rw-r--r-- | device/alignment_test.go | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/device/alignment_test.go b/device/alignment_test.go index a918112..bd2b02b 100644 --- a/device/alignment_test.go +++ b/device/alignment_test.go @@ -18,30 +18,6 @@ func checkAlignment(t *testing.T, name string, offset uintptr) { } } -// TestPeerAlignment checks that atomically-accessed fields are -// aligned to 64-bit boundaries, as required by the atomic package. -// -// Unfortunately, violating this rule on 32-bit platforms results in a -// hard segfault at runtime. -func TestPeerAlignment(t *testing.T) { - var p Peer - - typ := reflect.TypeOf(&p).Elem() - t.Logf("Peer type size: %d, with fields:", typ.Size()) - for i := 0; i < typ.NumField(); i++ { - field := typ.Field(i) - t.Logf("\t%30s\toffset=%3v\t(type size=%3d, align=%d)", - field.Name, - field.Offset, - field.Type.Size(), - field.Type.Align(), - ) - } - - checkAlignment(t, "Peer.stats", unsafe.Offsetof(p.stats)) - checkAlignment(t, "Peer.isRunning", unsafe.Offsetof(p.isRunning)) -} - // TestDeviceAlignment checks that atomically-accessed fields are // aligned to 64-bit boundaries, as required by the atomic package. // |