mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
net: rename test files
This change renames {ipraw,tcp,udp,unix}_test.go to {ipraw,tcp,udp,unix}sock_test.go for clarification. Also moves NSS-related system configuration test helpers into main_conf_test.go and main_noconf_test.go. Change-Id: I28ba1e8ceda7b182ee3aa85f0ca3321388ba45e2 Reviewed-on: https://go-review.googlesource.com/19787 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
1439158120
commit
08f1a778c9
38
src/net/main_conf_test.go
Normal file
38
src/net/main_conf_test.go
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// Copyright 2015 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !nacl,!plan9,!windows
|
||||||
|
|
||||||
|
package net
|
||||||
|
|
||||||
|
// forceGoDNS forces the resolver configuration to use the pure Go resolver
|
||||||
|
// and returns a fixup function to restore the old settings.
|
||||||
|
func forceGoDNS() func() {
|
||||||
|
c := systemConf()
|
||||||
|
oldGo := c.netGo
|
||||||
|
oldCgo := c.netCgo
|
||||||
|
fixup := func() {
|
||||||
|
c.netGo = oldGo
|
||||||
|
c.netCgo = oldCgo
|
||||||
|
}
|
||||||
|
c.netGo = true
|
||||||
|
c.netCgo = false
|
||||||
|
return fixup
|
||||||
|
}
|
||||||
|
|
||||||
|
// forceCgoDNS forces the resolver configuration to use the cgo resolver
|
||||||
|
// and returns a fixup function to restore the old settings.
|
||||||
|
// (On non-Unix systems forceCgoDNS returns nil.)
|
||||||
|
func forceCgoDNS() func() {
|
||||||
|
c := systemConf()
|
||||||
|
oldGo := c.netGo
|
||||||
|
oldCgo := c.netCgo
|
||||||
|
fixup := func() {
|
||||||
|
c.netGo = oldGo
|
||||||
|
c.netCgo = oldCgo
|
||||||
|
}
|
||||||
|
c.netGo = false
|
||||||
|
c.netCgo = true
|
||||||
|
return fixup
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ package net
|
||||||
|
|
||||||
import "runtime"
|
import "runtime"
|
||||||
|
|
||||||
// See unix_test.go for what these (don't) do.
|
// See main_unix_test.go for what these (don't) do.
|
||||||
func forceGoDNS() func() {
|
func forceGoDNS() func() {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "plan9", "windows":
|
case "plan9", "windows":
|
||||||
|
@ -18,5 +18,5 @@ func forceGoDNS() func() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// See unix_test.go for what these (don't) do.
|
// See main_unix_test.go for what these (don't) do.
|
||||||
func forceCgoDNS() func() { return nil }
|
func forceCgoDNS() func() { return nil }
|
|
@ -440,34 +440,3 @@ func TestUnixUnlink(t *testing.T) {
|
||||||
t.Fatal("closing unix listener did not remove unix socket")
|
t.Fatal("closing unix listener did not remove unix socket")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// forceGoDNS forces the resolver configuration to use the pure Go resolver
|
|
||||||
// and returns a fixup function to restore the old settings.
|
|
||||||
func forceGoDNS() func() {
|
|
||||||
c := systemConf()
|
|
||||||
oldGo := c.netGo
|
|
||||||
oldCgo := c.netCgo
|
|
||||||
fixup := func() {
|
|
||||||
c.netGo = oldGo
|
|
||||||
c.netCgo = oldCgo
|
|
||||||
}
|
|
||||||
c.netGo = true
|
|
||||||
c.netCgo = false
|
|
||||||
return fixup
|
|
||||||
}
|
|
||||||
|
|
||||||
// forceCgoDNS forces the resolver configuration to use the cgo resolver
|
|
||||||
// and returns a fixup function to restore the old settings.
|
|
||||||
// (On non-Unix systems forceCgoDNS returns nil.)
|
|
||||||
func forceCgoDNS() func() {
|
|
||||||
c := systemConf()
|
|
||||||
oldGo := c.netGo
|
|
||||||
oldCgo := c.netCgo
|
|
||||||
fixup := func() {
|
|
||||||
c.netGo = oldGo
|
|
||||||
c.netCgo = oldCgo
|
|
||||||
}
|
|
||||||
c.netGo = false
|
|
||||||
c.netCgo = true
|
|
||||||
return fixup
|
|
||||||
}
|
|
Loading…
Reference in a new issue