1
0
mirror of https://github.com/golang/go synced 2024-11-25 05:57:57 -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=\ NOBENCH=\
container/vector\ container/vector\
TEST=\ # Disable tests that depend on an external network.
$(filter-out $(NOTEST),$(DIRS)) ifeq ($(DISABLE_NET_TESTS),1)
NOTEST+=http net
BENCH=\ endif
$(filter-out $(NOBENCH),$(TEST))
# Disable tests that NaCl cannot run yet. # Disable tests that NaCl cannot run yet.
ifeq ($(GOOS),nacl) ifeq ($(GOOS),nacl)
@ -172,6 +171,12 @@ NOTEST+=time # no syscall.Kill, syscall.SIGCHLD for sleep tests
NOTEST+=websocket # no network NOTEST+=websocket # no network
endif endif
TEST=\
$(filter-out $(NOTEST),$(DIRS))
BENCH=\
$(filter-out $(NOBENCH),$(TEST))
clean.dirs: $(addsuffix .clean, $(DIRS)) clean.dirs: $(addsuffix .clean, $(DIRS))
install.dirs: $(addsuffix .install, $(DIRS)) install.dirs: $(addsuffix .install, $(DIRS))
nuke.dirs: $(addsuffix .nuke, $(DIRS)) nuke.dirs: $(addsuffix .nuke, $(DIRS))

View File

@ -72,7 +72,7 @@ func importSend(imp *Importer, t *testing.T) {
} }
func TestExportSendImportReceive(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 { if err != nil {
t.Fatal("new exporter:", err) t.Fatal("new exporter:", err)
} }
@ -85,7 +85,7 @@ func TestExportSendImportReceive(t *testing.T) {
} }
func TestExportReceiveImportSend(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 { if err != nil {
t.Fatal("new exporter:", err) t.Fatal("new exporter:", err)
} }
@ -98,7 +98,7 @@ func TestExportReceiveImportSend(t *testing.T) {
} }
func TestClosingExportSendImportReceive(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 { if err != nil {
t.Fatal("new exporter:", err) t.Fatal("new exporter:", err)
} }

View File

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

View File

@ -20,7 +20,7 @@ var serverAddr string
func echoServer(ws *Conn) { io.Copy(ws, ws) } func echoServer(ws *Conn) { io.Copy(ws, ws) }
func startServer() { 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 { if e != nil {
log.Exitf("net.Listen tcp :0 %v", e) log.Exitf("net.Listen tcp :0 %v", e)
} }