mirror of
https://github.com/golang/go
synced 2024-11-23 00:30:07 -07:00
net: don't increase test table rows when using -test.count flag
Change-Id: I7881e3353dc5cd9755a79ea0eab146c6a0a08306 Reviewed-on: https://go-review.googlesource.com/23195 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
6de34e6e25
commit
d4ed8da996
@ -591,68 +591,67 @@ func TestDialerPartialDeadline(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
type dialerLocalAddrTest struct {
|
||||
network, raddr string
|
||||
laddr Addr
|
||||
error
|
||||
}
|
||||
|
||||
var dialerLocalAddrTests = []dialerLocalAddrTest{
|
||||
{"tcp4", "127.0.0.1", nil, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{}, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: ParseIP("0.0.0.0")}, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: ParseIP("0.0.0.0").To4()}, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: ParseIP("::")}, &AddrError{Err: "some error"}},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: ParseIP("127.0.0.1").To4()}, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: ParseIP("127.0.0.1").To16()}, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: IPv6loopback}, errNoSuitableAddress},
|
||||
{"tcp4", "127.0.0.1", &UDPAddr{}, &AddrError{Err: "some error"}},
|
||||
{"tcp4", "127.0.0.1", &UnixAddr{}, &AddrError{Err: "some error"}},
|
||||
|
||||
{"tcp6", "::1", nil, nil},
|
||||
{"tcp6", "::1", &TCPAddr{}, nil},
|
||||
{"tcp6", "::1", &TCPAddr{IP: ParseIP("0.0.0.0")}, nil},
|
||||
{"tcp6", "::1", &TCPAddr{IP: ParseIP("0.0.0.0").To4()}, nil},
|
||||
{"tcp6", "::1", &TCPAddr{IP: ParseIP("::")}, nil},
|
||||
{"tcp6", "::1", &TCPAddr{IP: ParseIP("127.0.0.1").To4()}, errNoSuitableAddress},
|
||||
{"tcp6", "::1", &TCPAddr{IP: ParseIP("127.0.0.1").To16()}, errNoSuitableAddress},
|
||||
{"tcp6", "::1", &TCPAddr{IP: IPv6loopback}, nil},
|
||||
{"tcp6", "::1", &UDPAddr{}, &AddrError{Err: "some error"}},
|
||||
{"tcp6", "::1", &UnixAddr{}, &AddrError{Err: "some error"}},
|
||||
|
||||
{"tcp", "127.0.0.1", nil, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{}, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{IP: ParseIP("0.0.0.0")}, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{IP: ParseIP("0.0.0.0").To4()}, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{IP: ParseIP("127.0.0.1").To4()}, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{IP: ParseIP("127.0.0.1").To16()}, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{IP: IPv6loopback}, errNoSuitableAddress},
|
||||
{"tcp", "127.0.0.1", &UDPAddr{}, &AddrError{Err: "some error"}},
|
||||
{"tcp", "127.0.0.1", &UnixAddr{}, &AddrError{Err: "some error"}},
|
||||
|
||||
{"tcp", "::1", nil, nil},
|
||||
{"tcp", "::1", &TCPAddr{}, nil},
|
||||
{"tcp", "::1", &TCPAddr{IP: ParseIP("0.0.0.0")}, nil},
|
||||
{"tcp", "::1", &TCPAddr{IP: ParseIP("0.0.0.0").To4()}, nil},
|
||||
{"tcp", "::1", &TCPAddr{IP: ParseIP("::")}, nil},
|
||||
{"tcp", "::1", &TCPAddr{IP: ParseIP("127.0.0.1").To4()}, errNoSuitableAddress},
|
||||
{"tcp", "::1", &TCPAddr{IP: ParseIP("127.0.0.1").To16()}, errNoSuitableAddress},
|
||||
{"tcp", "::1", &TCPAddr{IP: IPv6loopback}, nil},
|
||||
{"tcp", "::1", &UDPAddr{}, &AddrError{Err: "some error"}},
|
||||
{"tcp", "::1", &UnixAddr{}, &AddrError{Err: "some error"}},
|
||||
}
|
||||
|
||||
func TestDialerLocalAddr(t *testing.T) {
|
||||
if !supportsIPv4 || !supportsIPv6 {
|
||||
t.Skip("both IPv4 and IPv6 are required")
|
||||
}
|
||||
|
||||
type test struct {
|
||||
network, raddr string
|
||||
laddr Addr
|
||||
error
|
||||
}
|
||||
var tests = []test{
|
||||
{"tcp4", "127.0.0.1", nil, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{}, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: ParseIP("0.0.0.0")}, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: ParseIP("0.0.0.0").To4()}, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: ParseIP("::")}, &AddrError{Err: "some error"}},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: ParseIP("127.0.0.1").To4()}, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: ParseIP("127.0.0.1").To16()}, nil},
|
||||
{"tcp4", "127.0.0.1", &TCPAddr{IP: IPv6loopback}, errNoSuitableAddress},
|
||||
{"tcp4", "127.0.0.1", &UDPAddr{}, &AddrError{Err: "some error"}},
|
||||
{"tcp4", "127.0.0.1", &UnixAddr{}, &AddrError{Err: "some error"}},
|
||||
|
||||
{"tcp6", "::1", nil, nil},
|
||||
{"tcp6", "::1", &TCPAddr{}, nil},
|
||||
{"tcp6", "::1", &TCPAddr{IP: ParseIP("0.0.0.0")}, nil},
|
||||
{"tcp6", "::1", &TCPAddr{IP: ParseIP("0.0.0.0").To4()}, nil},
|
||||
{"tcp6", "::1", &TCPAddr{IP: ParseIP("::")}, nil},
|
||||
{"tcp6", "::1", &TCPAddr{IP: ParseIP("127.0.0.1").To4()}, errNoSuitableAddress},
|
||||
{"tcp6", "::1", &TCPAddr{IP: ParseIP("127.0.0.1").To16()}, errNoSuitableAddress},
|
||||
{"tcp6", "::1", &TCPAddr{IP: IPv6loopback}, nil},
|
||||
{"tcp6", "::1", &UDPAddr{}, &AddrError{Err: "some error"}},
|
||||
{"tcp6", "::1", &UnixAddr{}, &AddrError{Err: "some error"}},
|
||||
|
||||
{"tcp", "127.0.0.1", nil, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{}, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{IP: ParseIP("0.0.0.0")}, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{IP: ParseIP("0.0.0.0").To4()}, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{IP: ParseIP("127.0.0.1").To4()}, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{IP: ParseIP("127.0.0.1").To16()}, nil},
|
||||
{"tcp", "127.0.0.1", &TCPAddr{IP: IPv6loopback}, errNoSuitableAddress},
|
||||
{"tcp", "127.0.0.1", &UDPAddr{}, &AddrError{Err: "some error"}},
|
||||
{"tcp", "127.0.0.1", &UnixAddr{}, &AddrError{Err: "some error"}},
|
||||
|
||||
{"tcp", "::1", nil, nil},
|
||||
{"tcp", "::1", &TCPAddr{}, nil},
|
||||
{"tcp", "::1", &TCPAddr{IP: ParseIP("0.0.0.0")}, nil},
|
||||
{"tcp", "::1", &TCPAddr{IP: ParseIP("0.0.0.0").To4()}, nil},
|
||||
{"tcp", "::1", &TCPAddr{IP: ParseIP("::")}, nil},
|
||||
{"tcp", "::1", &TCPAddr{IP: ParseIP("127.0.0.1").To4()}, errNoSuitableAddress},
|
||||
{"tcp", "::1", &TCPAddr{IP: ParseIP("127.0.0.1").To16()}, errNoSuitableAddress},
|
||||
{"tcp", "::1", &TCPAddr{IP: IPv6loopback}, nil},
|
||||
{"tcp", "::1", &UDPAddr{}, &AddrError{Err: "some error"}},
|
||||
{"tcp", "::1", &UnixAddr{}, &AddrError{Err: "some error"}},
|
||||
}
|
||||
|
||||
if supportsIPv4map {
|
||||
dialerLocalAddrTests = append(dialerLocalAddrTests, dialerLocalAddrTest{
|
||||
tests = append(tests, test{
|
||||
"tcp", "127.0.0.1", &TCPAddr{IP: ParseIP("::")}, nil,
|
||||
})
|
||||
} else {
|
||||
dialerLocalAddrTests = append(dialerLocalAddrTests, dialerLocalAddrTest{
|
||||
tests = append(tests, test{
|
||||
"tcp", "127.0.0.1", &TCPAddr{IP: ParseIP("::")}, &AddrError{Err: "some error"},
|
||||
})
|
||||
}
|
||||
@ -682,7 +681,7 @@ func TestDialerLocalAddr(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
for _, tt := range dialerLocalAddrTests {
|
||||
for _, tt := range tests {
|
||||
d := &Dialer{LocalAddr: tt.laddr}
|
||||
var addr string
|
||||
ip := ParseIP(tt.raddr)
|
||||
|
Loading…
Reference in New Issue
Block a user