aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/net/listen_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2018-09-24 21:46:21 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-09-24 21:46:21 +0000
commitdd931d9b48647e898dc80927c532ae93cc09e192 (patch)
tree71be2295cd79b8a182f6130611658db8628772d5 /libgo/go/net/listen_test.go
parent779d8a5ad09b01428726ea5a0e6c87bd9ac3c0e4 (diff)
downloadgcc-dd931d9b48647e898dc80927c532ae93cc09e192.zip
gcc-dd931d9b48647e898dc80927c532ae93cc09e192.tar.gz
gcc-dd931d9b48647e898dc80927c532ae93cc09e192.tar.bz2
libgo: update to Go 1.11
Reviewed-on: https://go-review.googlesource.com/136435 gotools/: * Makefile.am (mostlyclean-local): Run chmod on check-go-dir to make sure it is writable. (check-go-tools): Likewise. (check-vet): Copy internal/objabi to check-vet-dir. * Makefile.in: Rebuild. From-SVN: r264546
Diffstat (limited to 'libgo/go/net/listen_test.go')
-rw-r--r--libgo/go/net/listen_test.go56
1 files changed, 55 insertions, 1 deletions
diff --git a/libgo/go/net/listen_test.go b/libgo/go/net/listen_test.go
index 96624f9..ffce8e2 100644
--- a/libgo/go/net/listen_test.go
+++ b/libgo/go/net/listen_test.go
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !plan9
+// +build !js,!plan9
package net
import (
+ "context"
"fmt"
"internal/testenv"
"os"
@@ -729,3 +730,56 @@ func TestClosingListener(t *testing.T) {
}
ln2.Close()
}
+
+func TestListenConfigControl(t *testing.T) {
+ switch runtime.GOOS {
+ case "nacl", "plan9":
+ t.Skipf("not supported on %s", runtime.GOOS)
+ }
+
+ t.Run("StreamListen", func(t *testing.T) {
+ for _, network := range []string{"tcp", "tcp4", "tcp6", "unix", "unixpacket"} {
+ if !testableNetwork(network) {
+ continue
+ }
+ ln, err := newLocalListener(network)
+ if err != nil {
+ t.Error(err)
+ continue
+ }
+ address := ln.Addr().String()
+ ln.Close()
+ lc := ListenConfig{Control: controlOnConnSetup}
+ ln, err = lc.Listen(context.Background(), network, address)
+ if err != nil {
+ t.Error(err)
+ continue
+ }
+ ln.Close()
+ }
+ })
+ t.Run("PacketListen", func(t *testing.T) {
+ for _, network := range []string{"udp", "udp4", "udp6", "unixgram"} {
+ if !testableNetwork(network) {
+ continue
+ }
+ c, err := newLocalPacketListener(network)
+ if err != nil {
+ t.Error(err)
+ continue
+ }
+ address := c.LocalAddr().String()
+ c.Close()
+ if network == "unixgram" {
+ os.Remove(address)
+ }
+ lc := ListenConfig{Control: controlOnConnSetup}
+ c, err = lc.ListenPacket(context.Background(), network, address)
+ if err != nil {
+ t.Error(err)
+ continue
+ }
+ c.Close()
+ }
+ })
+}