aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/net/server_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-02-11 14:53:56 -0800
committerIan Lance Taylor <iant@golang.org>2022-02-11 15:01:19 -0800
commit8dc2499aa62f768c6395c9754b8cabc1ce25c494 (patch)
tree43d7fd2bbfd7ad8c9625a718a5e8718889351994 /libgo/go/net/server_test.go
parent9a56779dbc4e2d9c15be8d31e36f2f59be7331a8 (diff)
downloadgcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.zip
gcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.tar.gz
gcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.tar.bz2
libgo: update to Go1.18beta2
gotools/ * Makefile.am (go_cmd_cgo_files): Add ast_go118.go (check-go-tool): Copy golang.org/x/tools directories. * Makefile.in: Regenerate. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/384695
Diffstat (limited to 'libgo/go/net/server_test.go')
-rw-r--r--libgo/go/net/server_test.go69
1 files changed, 30 insertions, 39 deletions
diff --git a/libgo/go/net/server_test.go b/libgo/go/net/server_test.go
index 7cbf152..6796d79 100644
--- a/libgo/go/net/server_test.go
+++ b/libgo/go/net/server_test.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build !js
-// +build !js
package net
@@ -78,10 +77,7 @@ func TestTCPServer(t *testing.T) {
}
}()
for i := 0; i < N; i++ {
- ls, err := (&streamListener{Listener: ln}).newLocalServer()
- if err != nil {
- t.Fatal(err)
- }
+ ls := (&streamListener{Listener: ln}).newLocalServer()
lss = append(lss, ls)
tpchs = append(tpchs, make(chan error, 1))
}
@@ -126,19 +122,19 @@ func TestTCPServer(t *testing.T) {
}
}
-var unixAndUnixpacketServerTests = []struct {
- network, address string
-}{
- {"unix", testUnixAddr()},
- {"unix", "@nettest/go/unix"},
-
- {"unixpacket", testUnixAddr()},
- {"unixpacket", "@nettest/go/unixpacket"},
-}
-
// TestUnixAndUnixpacketServer tests concurrent accept-read-write
// servers
func TestUnixAndUnixpacketServer(t *testing.T) {
+ var unixAndUnixpacketServerTests = []struct {
+ network, address string
+ }{
+ {"unix", testUnixAddr(t)},
+ {"unix", "@nettest/go/unix"},
+
+ {"unixpacket", testUnixAddr(t)},
+ {"unixpacket", "@nettest/go/unixpacket"},
+ }
+
const N = 3
for i, tt := range unixAndUnixpacketServerTests {
@@ -163,10 +159,7 @@ func TestUnixAndUnixpacketServer(t *testing.T) {
}
}()
for i := 0; i < N; i++ {
- ls, err := (&streamListener{Listener: ln}).newLocalServer()
- if err != nil {
- t.Fatal(err)
- }
+ ls := (&streamListener{Listener: ln}).newLocalServer()
lss = append(lss, ls)
tpchs = append(tpchs, make(chan error, 1))
}
@@ -188,7 +181,11 @@ func TestUnixAndUnixpacketServer(t *testing.T) {
}
t.Fatal(err)
}
- defer os.Remove(c.LocalAddr().String())
+
+ if addr := c.LocalAddr(); addr != nil {
+ t.Logf("connected %s->%s", addr, lss[i].Listener.Addr())
+ }
+
defer c.Close()
trchs = append(trchs, make(chan error, 1))
go transceiver(c, []byte("UNIX AND UNIXPACKET SERVER TEST"), trchs[i])
@@ -267,10 +264,7 @@ func TestUDPServer(t *testing.T) {
t.Fatal(err)
}
- ls, err := (&packetListener{PacketConn: c1}).newLocalServer()
- if err != nil {
- t.Fatal(err)
- }
+ ls := (&packetListener{PacketConn: c1}).newLocalServer()
defer ls.teardown()
tpch := make(chan error, 1)
handler := func(ls *localPacketServer, c PacketConn) { packetTransponder(c, tpch) }
@@ -319,18 +313,18 @@ func TestUDPServer(t *testing.T) {
}
}
-var unixgramServerTests = []struct {
- saddr string // server endpoint
- caddr string // client endpoint
- dial bool // test with Dial
-}{
- {saddr: testUnixAddr(), caddr: testUnixAddr()},
- {saddr: testUnixAddr(), caddr: testUnixAddr(), dial: true},
-
- {saddr: "@nettest/go/unixgram/server", caddr: "@nettest/go/unixgram/client"},
-}
-
func TestUnixgramServer(t *testing.T) {
+ var unixgramServerTests = []struct {
+ saddr string // server endpoint
+ caddr string // client endpoint
+ dial bool // test with Dial
+ }{
+ {saddr: testUnixAddr(t), caddr: testUnixAddr(t)},
+ {saddr: testUnixAddr(t), caddr: testUnixAddr(t), dial: true},
+
+ {saddr: "@nettest/go/unixgram/server", caddr: "@nettest/go/unixgram/client"},
+ }
+
for i, tt := range unixgramServerTests {
if !testableListenArgs("unixgram", tt.saddr, "") {
t.Logf("skipping %s test", "unixgram "+tt.saddr+"<-"+tt.caddr)
@@ -345,10 +339,7 @@ func TestUnixgramServer(t *testing.T) {
t.Fatal(err)
}
- ls, err := (&packetListener{PacketConn: c1}).newLocalServer()
- if err != nil {
- t.Fatal(err)
- }
+ ls := (&packetListener{PacketConn: c1}).newLocalServer()
defer ls.teardown()
tpch := make(chan error, 1)
handler := func(ls *localPacketServer, c PacketConn) { packetTransponder(c, tpch) }