1
0
mirror of https://github.com/golang/go synced 2024-11-21 13:54:43 -07:00

pkg/Makefile: allow DISABLE_NET_TESTS=1 to disable network tests

netchan, rpc, websocket: run test servers on 127.0.0.1,
to avoid conflict with OS X firewall.

TBR=r
CC=golang-dev
https://golang.org/cl/1689046
This commit is contained in:
Russ Cox 2010-06-21 13:05:38 -07:00
parent e495351ff7
commit 96d35c6984
4 changed files with 16 additions and 11 deletions

View File

@ -146,11 +146,10 @@ NOTEST=\
NOBENCH=\
container/vector\
TEST=\
$(filter-out $(NOTEST),$(DIRS))
BENCH=\
$(filter-out $(NOBENCH),$(TEST))
# Disable tests that depend on an external network.
ifeq ($(DISABLE_NET_TESTS),1)
NOTEST+=http net
endif
# Disable tests that NaCl cannot run yet.
ifeq ($(GOOS),nacl)
@ -172,6 +171,12 @@ NOTEST+=time # no syscall.Kill, syscall.SIGCHLD for sleep tests
NOTEST+=websocket # no network
endif
TEST=\
$(filter-out $(NOTEST),$(DIRS))
BENCH=\
$(filter-out $(NOBENCH),$(TEST))
clean.dirs: $(addsuffix .clean, $(DIRS))
install.dirs: $(addsuffix .install, $(DIRS))
nuke.dirs: $(addsuffix .nuke, $(DIRS))

View File

@ -72,7 +72,7 @@ func importSend(imp *Importer, t *testing.T) {
}
func TestExportSendImportReceive(t *testing.T) {
exp, err := NewExporter("tcp", ":0")
exp, err := NewExporter("tcp", "127.0.0.1:0")
if err != nil {
t.Fatal("new exporter:", err)
}
@ -85,7 +85,7 @@ func TestExportSendImportReceive(t *testing.T) {
}
func TestExportReceiveImportSend(t *testing.T) {
exp, err := NewExporter("tcp", ":0")
exp, err := NewExporter("tcp", "127.0.0.1:0")
if err != nil {
t.Fatal("new exporter:", err)
}
@ -98,7 +98,7 @@ func TestExportReceiveImportSend(t *testing.T) {
}
func TestClosingExportSendImportReceive(t *testing.T) {
exp, err := NewExporter("tcp", ":0")
exp, err := NewExporter("tcp", "127.0.0.1:0")
if err != nil {
t.Fatal("new exporter:", err)
}

View File

@ -55,7 +55,7 @@ func (t *Arith) Error(args *Args, reply *Reply) os.Error {
func startServer() {
Register(new(Arith))
l, e := net.Listen("tcp", ":0") // any available address
l, e := net.Listen("tcp", "127.0.0.1:0") // any available address
if e != nil {
log.Exitf("net.Listen tcp :0: %v", e)
}
@ -64,7 +64,7 @@ func startServer() {
go Accept(l)
HandleHTTP()
l, e = net.Listen("tcp", ":0") // any available address
l, e = net.Listen("tcp", "127.0.0.1:0") // any available address
if e != nil {
log.Stderrf("net.Listen tcp :0: %v", e)
os.Exit(1)

View File

@ -20,7 +20,7 @@ var serverAddr string
func echoServer(ws *Conn) { io.Copy(ws, ws) }
func startServer() {
l, e := net.Listen("tcp", ":0") // any available address
l, e := net.Listen("tcp", "127.0.0.1:0") // any available address
if e != nil {
log.Exitf("net.Listen tcp :0 %v", e)
}