diff options
author | Zach Koopmans <zkoopmans@google.com> | 2021-03-29 13:28:32 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-29 13:30:21 -0700 |
commit | 8a2f7e716dcc62f04d2808e8ade34941c94fc956 (patch) | |
tree | b2195d5728dcbc4f4e59c23ad95d7486ef744371 /test | |
parent | b125afba416ebeba906ea595a44a55afe4729d64 (diff) |
[syserror] Split usermem package
Split usermem package to help remove syserror dependency in go_marshal.
New hostarch package contains code not dependent on syserror.
PiperOrigin-RevId: 365651233
Diffstat (limited to 'test')
-rw-r--r-- | test/iptables/BUILD | 2 | ||||
-rw-r--r-- | test/iptables/nat.go | 6 | ||||
-rw-r--r-- | test/packetimpact/testbench/BUILD | 2 | ||||
-rw-r--r-- | test/packetimpact/testbench/rawsockets.go | 4 | ||||
-rw-r--r-- | test/packetimpact/tests/BUILD | 6 | ||||
-rw-r--r-- | test/packetimpact/tests/tcp_info_test.go | 6 | ||||
-rw-r--r-- | test/packetimpact/tests/tcp_rack_test.go | 6 | ||||
-rw-r--r-- | test/packetimpact/tests/tcp_retransmits_test.go | 4 |
8 files changed, 18 insertions, 18 deletions
diff --git a/test/iptables/BUILD b/test/iptables/BUILD index 94d4ca2d4..9805665ac 100644 --- a/test/iptables/BUILD +++ b/test/iptables/BUILD @@ -16,8 +16,8 @@ go_library( visibility = ["//test/iptables:__subpackages__"], deps = [ "//pkg/binary", + "//pkg/hostarch", "//pkg/test/testutil", - "//pkg/usermem", "@org_golang_x_sys//unix:go_default_library", ], ) diff --git a/test/iptables/nat.go b/test/iptables/nat.go index 70d8a1832..0776639a7 100644 --- a/test/iptables/nat.go +++ b/test/iptables/nat.go @@ -22,7 +22,7 @@ import ( "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/binary" - "gvisor.dev/gvisor/pkg/usermem" + "gvisor.dev/gvisor/pkg/hostarch" ) const redirectPort = 42 @@ -848,7 +848,7 @@ func recvOrigDstAddr4(sockfd int) (unix.RawSockaddrInet4, error) { return unix.RawSockaddrInet4{}, err } var addr unix.RawSockaddrInet4 - binary.Unmarshal(buf, usermem.ByteOrder, &addr) + binary.Unmarshal(buf, hostarch.ByteOrder, &addr) return addr, nil } @@ -858,7 +858,7 @@ func recvOrigDstAddr6(sockfd int) (unix.RawSockaddrInet6, error) { return unix.RawSockaddrInet6{}, err } var addr unix.RawSockaddrInet6 - binary.Unmarshal(buf, usermem.ByteOrder, &addr) + binary.Unmarshal(buf, hostarch.ByteOrder, &addr) return addr, nil } diff --git a/test/packetimpact/testbench/BUILD b/test/packetimpact/testbench/BUILD index 43b4c7ca1..616215dc3 100644 --- a/test/packetimpact/testbench/BUILD +++ b/test/packetimpact/testbench/BUILD @@ -16,11 +16,11 @@ go_library( ], visibility = ["//test/packetimpact:__subpackages__"], deps = [ + "//pkg/hostarch", "//pkg/tcpip", "//pkg/tcpip/buffer", "//pkg/tcpip/header", "//pkg/tcpip/seqnum", - "//pkg/usermem", "//test/packetimpact/proto:posix_server_go_proto", "@com_github_google_go_cmp//cmp:go_default_library", "@com_github_google_go_cmp//cmp/cmpopts:go_default_library", diff --git a/test/packetimpact/testbench/rawsockets.go b/test/packetimpact/testbench/rawsockets.go index 1ac96626a..feeb0888a 100644 --- a/test/packetimpact/testbench/rawsockets.go +++ b/test/packetimpact/testbench/rawsockets.go @@ -23,7 +23,7 @@ import ( "time" "golang.org/x/sys/unix" - "gvisor.dev/gvisor/pkg/usermem" + "gvisor.dev/gvisor/pkg/hostarch" ) // Sniffer can sniff raw packets on the wire. @@ -34,7 +34,7 @@ type Sniffer struct { func htons(x uint16) uint16 { buf := [2]byte{} binary.BigEndian.PutUint16(buf[:], x) - return usermem.ByteOrder.Uint16(buf[:]) + return hostarch.ByteOrder.Uint16(buf[:]) } // NewSniffer creates a Sniffer connected to *device. diff --git a/test/packetimpact/tests/BUILD b/test/packetimpact/tests/BUILD index c0deb33e5..92103c1e9 100644 --- a/test/packetimpact/tests/BUILD +++ b/test/packetimpact/tests/BUILD @@ -105,8 +105,8 @@ packetimpact_testbench( deps = [ "//pkg/abi/linux", "//pkg/binary", + "//pkg/hostarch", "//pkg/tcpip/header", - "//pkg/usermem", "//test/packetimpact/testbench", "@org_golang_x_sys//unix:go_default_library", ], @@ -354,9 +354,9 @@ packetimpact_testbench( deps = [ "//pkg/abi/linux", "//pkg/binary", + "//pkg/hostarch", "//pkg/tcpip/header", "//pkg/tcpip/seqnum", - "//pkg/usermem", "//test/packetimpact/testbench", "@org_golang_x_sys//unix:go_default_library", ], @@ -368,8 +368,8 @@ packetimpact_testbench( deps = [ "//pkg/abi/linux", "//pkg/binary", + "//pkg/hostarch", "//pkg/tcpip/header", - "//pkg/usermem", "//test/packetimpact/testbench", "@org_golang_x_sys//unix:go_default_library", ], diff --git a/test/packetimpact/tests/tcp_info_test.go b/test/packetimpact/tests/tcp_info_test.go index 3fc2c7fe5..93f58ec49 100644 --- a/test/packetimpact/tests/tcp_info_test.go +++ b/test/packetimpact/tests/tcp_info_test.go @@ -22,8 +22,8 @@ import ( "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/binary" + "gvisor.dev/gvisor/pkg/hostarch" "gvisor.dev/gvisor/pkg/tcpip/header" - "gvisor.dev/gvisor/pkg/usermem" "gvisor.dev/gvisor/test/packetimpact/testbench" ) @@ -58,7 +58,7 @@ func TestTCPInfo(t *testing.T) { if got, want := len(infoBytes), linux.SizeOfTCPInfo; got != want { t.Fatalf("expected %T, got %d bytes want %d bytes", info, got, want) } - binary.Unmarshal(infoBytes, usermem.ByteOrder, &info) + binary.Unmarshal(infoBytes, hostarch.ByteOrder, &info) rtt := time.Duration(info.RTT) * time.Microsecond rttvar := time.Duration(info.RTTVar) * time.Microsecond @@ -99,7 +99,7 @@ func TestTCPInfo(t *testing.T) { if got, want := len(infoBytes), linux.SizeOfTCPInfo; got != want { t.Fatalf("expected %T, got %d bytes want %d bytes", info, got, want) } - binary.Unmarshal(infoBytes, usermem.ByteOrder, &info) + binary.Unmarshal(infoBytes, hostarch.ByteOrder, &info) if info.CaState != linux.TCP_CA_Loss { t.Errorf("expected the connection to be in loss recovery, got: %v want: %v", info.CaState, linux.TCP_CA_Loss) } diff --git a/test/packetimpact/tests/tcp_rack_test.go b/test/packetimpact/tests/tcp_rack_test.go index 0a5b0f12b..ff1431bbf 100644 --- a/test/packetimpact/tests/tcp_rack_test.go +++ b/test/packetimpact/tests/tcp_rack_test.go @@ -22,9 +22,9 @@ import ( "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/binary" + "gvisor.dev/gvisor/pkg/hostarch" "gvisor.dev/gvisor/pkg/tcpip/header" "gvisor.dev/gvisor/pkg/tcpip/seqnum" - "gvisor.dev/gvisor/pkg/usermem" "gvisor.dev/gvisor/test/packetimpact/testbench" ) @@ -74,7 +74,7 @@ func getRTTAndRTO(t *testing.T, dut testbench.DUT, acceptFd int32) (rtt, rto tim if got, want := len(infoBytes), linux.SizeOfTCPInfo; got != want { t.Fatalf("expected %T, got %d bytes want %d bytes", info, got, want) } - binary.Unmarshal(infoBytes, usermem.ByteOrder, &info) + binary.Unmarshal(infoBytes, hostarch.ByteOrder, &info) return time.Duration(info.RTT) * time.Microsecond, time.Duration(info.RTO) * time.Microsecond } @@ -407,7 +407,7 @@ func TestRACKWithLostRetransmission(t *testing.T) { if got, want := len(infoBytes), linux.SizeOfTCPInfo; got != want { t.Fatalf("expected %T, got %d bytes want %d bytes", info, got, want) } - binary.Unmarshal(infoBytes, usermem.ByteOrder, &info) + binary.Unmarshal(infoBytes, hostarch.ByteOrder, &info) if info.CaState != linux.TCP_CA_Recovery { t.Fatalf("expected connection to be in fast recovery, want: %v got: %v", linux.TCP_CA_Recovery, info.CaState) } diff --git a/test/packetimpact/tests/tcp_retransmits_test.go b/test/packetimpact/tests/tcp_retransmits_test.go index 3dc8f63ab..1eafe20c3 100644 --- a/test/packetimpact/tests/tcp_retransmits_test.go +++ b/test/packetimpact/tests/tcp_retransmits_test.go @@ -23,8 +23,8 @@ import ( "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/binary" + "gvisor.dev/gvisor/pkg/hostarch" "gvisor.dev/gvisor/pkg/tcpip/header" - "gvisor.dev/gvisor/pkg/usermem" "gvisor.dev/gvisor/test/packetimpact/testbench" ) @@ -38,7 +38,7 @@ func getRTO(t *testing.T, dut testbench.DUT, acceptFd int32) (rto time.Duration) if got, want := len(infoBytes), linux.SizeOfTCPInfo; got != want { t.Fatalf("unexpected size for TCP_INFO, got %d bytes want %d bytes", got, want) } - binary.Unmarshal(infoBytes, usermem.ByteOrder, &info) + binary.Unmarshal(infoBytes, hostarch.ByteOrder, &info) return time.Duration(info.RTO) * time.Microsecond } |