* gcc-interface/decl.c (warn_on_field_placement): Issue the warning
[official-gcc.git] / libgo / go / net / main_unix_test.go
blob8c8f94479de863635a192bce8730b14c7819be66
1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris
7 package net
9 var (
10 // Placeholders for saving original socket system calls.
11 origSocket = socketFunc
12 origClose = closeFunc
13 origConnect = connectFunc
14 origListen = listenFunc
15 origAccept = acceptFunc
16 origGetsockoptInt = getsockoptIntFunc
18 extraTestHookInstallers []func()
19 extraTestHookUninstallers []func()
22 func installTestHooks() {
23 socketFunc = sw.Socket
24 closeFunc = sw.Close
25 connectFunc = sw.Connect
26 listenFunc = sw.Listen
27 acceptFunc = sw.Accept
28 getsockoptIntFunc = sw.GetsockoptInt
30 for _, fn := range extraTestHookInstallers {
31 fn()
35 func uninstallTestHooks() {
36 socketFunc = origSocket
37 closeFunc = origClose
38 connectFunc = origConnect
39 listenFunc = origListen
40 acceptFunc = origAccept
41 getsockoptIntFunc = origGetsockoptInt
43 for _, fn := range extraTestHookUninstallers {
44 fn()
48 // forceCloseSockets must be called only from TestMain.
49 func forceCloseSockets() {
50 for s := range sw.Sockets() {
51 closeFunc(s)