diff options
author | Rahat Mahmood <rahat@google.com> | 2021-04-27 16:17:03 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-27 16:20:01 -0700 |
commit | f54d87b9eceee7f6069a4faf2628f19b8752ad06 (patch) | |
tree | 93cab74a7b455dfbf035c55e034ec8596f746d4a /pkg/sentry/socket/netlink/message_test.go | |
parent | 9ec49aabd34ecf9eba982439abd2ada4617d576a (diff) |
Remove uses of the binary package from networking code.
Co-Author: ayushranjan
PiperOrigin-RevId: 370785009
Diffstat (limited to 'pkg/sentry/socket/netlink/message_test.go')
-rw-r--r-- | pkg/sentry/socket/netlink/message_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/sentry/socket/netlink/message_test.go b/pkg/sentry/socket/netlink/message_test.go index ef13d9386..968968469 100644 --- a/pkg/sentry/socket/netlink/message_test.go +++ b/pkg/sentry/socket/netlink/message_test.go @@ -20,13 +20,31 @@ import ( "testing" "gvisor.dev/gvisor/pkg/abi/linux" + "gvisor.dev/gvisor/pkg/marshal" + "gvisor.dev/gvisor/pkg/marshal/primitive" "gvisor.dev/gvisor/pkg/sentry/socket/netlink" ) type dummyNetlinkMsg struct { + marshal.StubMarshallable Foo uint16 } +func (*dummyNetlinkMsg) SizeBytes() int { + return 2 +} + +func (m *dummyNetlinkMsg) MarshalUnsafe(dst []byte) { + p := primitive.Uint16(m.Foo) + p.MarshalUnsafe(dst) +} + +func (m *dummyNetlinkMsg) UnmarshalUnsafe(src []byte) { + var p primitive.Uint16 + p.UnmarshalUnsafe(src) + m.Foo = uint16(p) +} + func TestParseMessage(t *testing.T) { tests := []struct { desc string |